Пример #1
0
function tosql_set_update($vars = array())
{
    $ress = array();
    foreach ($vars as $k => $v) {
        $ress[] = $k . '=' . tosql($v);
    }
    return implode(', ', $ress);
}
include_once "configuration.php";
$menustudent = 1;
$web_user = $_SESSION['UserId'];
$current_year = $_SESSION['CurrentYear'];
//Get student id
$studentid = get_param("studentid");
//Get attendance id
$gradeid = get_param("gradeid");
//Get action
$action = get_param("action");
//Get info from form
$quarter = get_param("quarter");
$grade = tosql(get_param("grade"), "Text");
$effort = tosql(get_param("effort"), "Text");
$conduct = tosql(get_param("conduct"), "Text");
$gradenotes = tosql(get_param("gradenotes"), "Text");
$comment1 = get_param("comment1");
$comment2 = get_param("comment2");
$comment3 = get_param("comment3");
$subject = get_param("subject");
//get custom fields
$custom_grade_fields = get_param("custom_grade_fields");
//array
$custom_fields = get_param("custom_fields");
$new_custom_field_id = get_param("new_custom_field_id");
$new_custom_field_data = get_param("new_custom_field_data");
//Validate fields
$msgFormErr = "";
if (!strlen($quarter)) {
    $msgFormErr .= _ADMIN_MANAGE_GRADES_4_ENTER_QUARTER . "<br>";
}
     } else {
         $sSQL = "DELETE FROM media_codes WHERE media_codes_id='" . $media_codes_id . "'";
         $db->query($sSQL);
     }
     break;
 case "add":
     $media_codes_desc = get_param("medianame");
     $media_codes_id1 = get_param("id1");
     $media_codes_id2 = get_param("id2");
     /*Duplicates are fine (i.e. textbooks) so don't check for them
     		$tot = $db->get_var("SELECT count(*) FROM media_codes WHERE media_codes.media_codes_desc='".$media_codes_desc."'");
     		if ($tot>0){
     			$msgFormErr=_ADMIN_MEDIA_CODES_1_DUP;
     		}else{
     		*/
     $sSQL = "INSERT INTO media_codes (media_codes_desc, id1, id2) \n\t\tVALUES (" . tosql($media_codes_desc, "Text") . " ,'" . $media_codes_id1 . "', '" . $media_codes_id2 . "')";
     $db->query($sSQL);
     //};
     break;
 case "edit":
     $media_codes_id = get_param("id");
     $sSQL = "SELECT media_codes_desc, id1, id2 FROM media_codes WHERE \nmedia_codes_id={$media_codes_id}";
     $media_all = $db->get_row($sSQL);
     $media_codes_desc = $media_all->media_codes_desc;
     $id1 = $media_all->id1;
     $id2 = $media_all->id2;
     // echo $media_codes_desc, $id1, $id2;
     break;
 case "update":
     $media_codes_id = get_param("id");
     $media_codes_desc = get_param("medianame");
if (!strlen($term)) {
    $msgFormErr .= _GRADE_STUDENT_4_ENTER_QUARTER . "<br>";
}
if (strlen($grade) < 1) {
    $msgFormErr .= _GRADE_STUDENT_4_ENTER_OVERALL . "<br>";
}
if (!strlen($effort)) {
    $msgFormErr .= _GRADE_STUDENT_4_ENTER_EFFORT . "<br>";
}
if (!strlen($conduct)) {
    $msgFormErr .= _GRADE_STUDENT_4_ENTER_CONDUCT . "<br>";
}
//After validation, we must convert the grade,effort,conduct fields to text for insertion into the db.
$grade = tosql($grade, "Text");
$effort = tosql($effort, "Text");
$conduct = tosql($conduct, "Text");
//Errors found
if (strlen($msgFormErr > 0)) {
    $msgheader = _GRADE_STUDENT_4_FORMERROR;
}
//No errors found
if (!strlen($msgFormErr)) {
    //	if($action=="update"){
    //		$msgheader="Updating";
    //		$sSQL="UPDATE grade_history SET grade_history_quarter='".$quarter."', grade_history_grade='".$grade."', grade_history_effort='".$effort."', grade_history_conduct='".$conduct."', grade_history_comment1='".$comment1."', grade_history_comment2='".$comment2."', grade_history_comment3='".$comment3."', grade_history_notes='".$gradenotes."' WHERE grade_history_id='".$gradeid."'";
    //		$db->query($sSQL);
    //		$url="teacher_manage_grades_2.php?studentid=".$studentid."&gradeid=".$gradeid;
    //		header("Location: $url");
    //		exit();
    //	}else{
    $term = $_SESSION[term];
if (!strlen($action)) {
    $action = "none";
}
//Add or Remove grades according to admin choice
switch ($action) {
    case "remove":
        $grade_id = get_param("id");
        if ($norem = $db->get_results("SELECT grade_history_id FROM grade_history WHERE grade_history_grade={$grade_id} OR grade_history_effort={$grade_id} OR grade_history_conduct={$grade_id}")) {
            $msgFormErr = _ADMIN_SGRADES_FORM_ERROR;
        } else {
            $sSQL = "DELETE FROM grade_names WHERE grade_names_id={$grade_id}";
            $db->query($sSQL);
        }
        break;
    case "add":
        $grade_desc = tosql(get_param("gradename"), "Text");
        $sSQL = "INSERT INTO grade_names (grade_names_desc) VALUES (" . $grade_desc . ")";
        $db->query($sSQL);
        break;
    case "edit":
        $grade_id = get_param("id");
        $sSQL = "SELECT grade_names_desc FROM grade_names WHERE grade_names_id={$grade_id}";
        $grade_desc = $db->get_var($sSQL);
        break;
    case "update":
        $grade_id = get_param("id");
        $grade_desc = get_param("gradename");
        $sSQL = "UPDATE grade_names SET grade_names_desc='{$grade_desc}' WHERE grade_names_id={$grade_id}";
        $db->query($sSQL);
        break;
}
Пример #6
0
function Form1_show()
{
    global $sForm1Err;
    global $db;
    global $sFileName;
    global $styles;
    $querystring = get_param("querystring");
    $ret_page = get_param("ret_page");
    $sFormTitle = "Ingrese usuario y contrase&nacute;a";
    //-------------------------------
    // Form1 Show begin
    //-------------------------------
    //-------------------------------
    // Form1 Open Event begin
    // Form1 Open Event end
    //-------------------------------
    ?>
    <table class="FormTABLE">
    <form action="<?php 
    echo $sFileName;
    ?>
" method="POST">
    <input type="hidden" name="FormName" value="Form1">

    <tr><td class="FormHeaderTD" colspan="2"><font class="FormHeaderFONT"><?php 
    echo $sFormTitle;
    ?>
</font></td></tr>
    <?php 
    if ($sForm1Err) {
        ?>
    <tr><td colspan="2" class="DataTD"><font class="DataFONT"><?php 
        echo $sForm1Err;
        ?>
</font></td></tr>
    <?php 
    }
    ?>

  <?php 
    if (get_session("UserID") == "") {
        //-------------------------------
        //- User is not logged in
        //-------------------------------
        ?>
      <tr><td class="FieldCaptionTD"><font class="FieldCaptionFONT">Identificaci&oacute;n</font></td><td class="DataTD"><input type="text" name="Login" value="<?php 
        echo tohtml(get_param("Login"));
        ?>
" maxlength="50"></td></tr>
      <tr><td class="FieldCaptionTD"><font class="FieldCaptionFONT">Palabra Clave</font></td><td class="DataTD"><input type="password" name="Password" maxlength="50"></td></tr>
      <tr><td colspan="2">
      <input type="hidden" name="FormAction" value="login">
      <input type="submit" value="Conexión">
      </td></tr>
    <?php 
    } else {
        //-------------------------------
        // User is logged in
        //-------------------------------
        $usuario = get_session("UserID");
        $db->query("SELECT USUA_LOGIN FROM USUARIO WHERE USUA_LOGIN="******"Text"));
        $db->next_record();
        ?>
      <tr><td class="DataTD"><font class="DataFONT"> <?php 
        echo $db->f("USUA_LOGIN");
        ?>
</font>
      <input type="hidden" name="FormAction" value="logout">
      <input type="submit" value="Desconexión">
      </td></tr>
<?php 
    }
    ?>
  <input type="hidden" name="ret_page" value="<?php 
    echo $ret_page;
    ?>
"><input type="hidden" name="querystring" value="<?php 
    echo $querystring;
    ?>
"></td></tr>
  </form></table>
<?php 
    //-------------------------------
    // Form1 Close Event begin
    // Form1 Close Event end
    //-------------------------------
    //-------------------------------
    // Form1 Show end
    //-------------------------------
}
        $infraction_codes_id = get_param("id");
        if ($norem = $db->get_results("SELECT discipline_history_code FROM discipline_history WHERE discipline_history_code={$infraction_codes_id}")) {
            $msgFormErr = _ADMIN_INFRACTION_CODES_FORM_ERROR;
        } else {
            $sSQL = "DELETE FROM infraction_codes WHERE infraction_codes_id={$infraction_codes_id}";
            $db->query($sSQL);
        }
        break;
    case "add":
        $infraction_codes_desc = get_param("infractionname");
        //Check for duplicates
        $tot = $db->get_var("SELECT count(*) FROM infraction_codes WHERE infraction_codes.infraction_codes_desc = '{$infraction_codes_desc}'");
        if ($tot > 0) {
            $msgFormErr = _ADMIN_INFRACTION_CODES_DUP;
        } else {
            $sSQL = "INSERT INTO infraction_codes (infraction_codes_desc) VALUES (" . tosql($infraction_codes_desc, "Text") . ")";
            $db->query($sSQL);
        }
        break;
    case "edit":
        $infraction_codes_id = get_param("id");
        $sSQL = "SELECT infraction_codes_desc FROM infraction_codes WHERE infraction_codes_id={$infraction_codes_id}";
        $infraction_codes_desc = $db->get_var($sSQL);
        break;
    case "update":
        $infraction_codes_id = get_param("id");
        $infraction_codes_desc = get_param("infractionname");
        $sSQL = "UPDATE infraction_codes SET infraction_codes_desc='{$infraction_codes_desc}' WHERE infraction_codes_id={$infraction_codes_id}";
        $db->query($sSQL);
        break;
}
Пример #8
0
function get_checkbox_value($value, $checked_value, $unchecked_value, $type)
{
    if (!strlen($value)) {
        return tosql($unchecked_value, $type);
    } else {
        return tosql($checked_value, $type);
    }
}
}
//Add or Remove School Exams according to admin choice
switch ($action) {
    case "remove":
        $id_to_delete = get_param("id");
        $sSQL = "DELETE FROM exams_types WHERE exams_types_id={$id_to_delete}";
        $db->query($sSQL);
        break;
    case "add":
        $name = get_param("name");
        //Check for duplicates
        $tot = $db->get_var("SELECT count(*) FROM exams_types WHERE exams_types_desc='{$name}'");
        if ($tot > 0) {
            $msgFormErr = _ADMIN_EXAMS_TYPES_DUP;
        } else {
            $cSQL = "INSERT INTO exams_types (exams_types_desc) VALUES (" . tosql($name, "Text") . ")";
            $db->query($cSQL);
        }
        break;
    case "edit":
        $id = get_param("id");
        $cSQL = "SELECT exams_types_desc FROM exams_types WHERE exams_types_id = '{$id}'";
        $name = $db->get_var($cSQL);
        break;
    case "update":
        $id = get_param("id");
        $name = get_param("name");
        $cSQL = "UPDATE exams_types SET exams_types_desc = '{$name}' WHERE exams_types_id = '{$id}'";
        $db->query($cSQL);
        break;
}
Пример #10
0
function PRESTAMO_action($sAction)
{
    global $db;
    global $krd;
    //usuario actual
    global $dependencia;
    //dependencia del usuario actual
    $fldradicado = get_param("radicado");
    // Regresa al men� del radicado
    if ($sAction == "cancelar") {
        echo "..";
        // dejar esto para que el navegador deje hacer el submit
        echo "<form name=Atras action='../verradicado.php?krd={$krd}&verrad={$fldradicado}' method=post> </form>";
        echo "<script>document.Atras.submit();</script>";
    } elseif ($sAction == "insert") {
        $fldPRES_REQUERIMIENTO = get_param("s_PRES_REQUERIMIENTO");
        $fldPRES_FECH_PEDI = $db->conn->OffsetDate(0, $db->conn->sysTimeStamp);
        // Obtiene la ubicaci�n f�sica de los documentos
        $fldPRES_DEPE_ARCH = substr($fldradicado, 4, 3);
        $query = "SELECT UBIC_DEPE_ARCH FROM UBICACION_FISICA WHERE UBIC_DEPE_RADI=" . $fldPRES_DEPE_ARCH;
        $db->conn->SetFetchMode(ADODB_FETCH_ASSOC);
        $rs = $db->conn->query($query);
        if (!$rs->EOF) {
            $fldPRES_DEPE_ARCH = $rs->fields['UBIC_DEPE_ARCH'];
        }
        // Genera PRES_ID
        //$db->conn->debug = true;
        $sec = $db->conn->nextId('SEC_PRESTAMO');
        /*if($driver=="oci8")
          {
          	echo "<hr>ENTRO<HR>";
          $sSQL = "SELECT PRES_SEQ.NEXTVAL AS PRES_ID FROM PRESTAMO";       
             $rs = $db->conn->query($sSQL);
           if(!$rs->EOF)
            { 
            	$fldPRES_ID =$rs->fields("PRES_ID"); 
            } 
          }*/
        // Create SQL statement
        //$db->conn->debug = true;
        $sSQL = "insert into PRESTAMO(\n                  PRES_ID,\n                  RADI_NUME_RADI,\n\t\t   \t      USUA_LOGIN_ACTU,\n\t\t\t      DEPE_CODI,\n                  PRES_FECH_PEDI,\t\t\t\t  \n                  PRES_DEPE_ARCH,\n                  PRES_ESTADO,\n                  PRES_REQUERIMIENTO)\n               values (" . tosql($sec, "Number") . "," . tosql($fldradicado, "Text") . "," . tosql($krd, "Text") . "," . tosql($dependencia, "Number") . "," . $fldPRES_FECH_PEDI . "," . tosql($fldPRES_DEPE_ARCH, "Number") . ", \n                  1," . tosql($fldPRES_REQUERIMIENTO, "Number") . ")";
        // Execute SQL statement
        if ($db->conn->query($sSQL)) {
        } else {
            echo "<script> alert(\"El registro no pudo ser realizado\"); </script>";
        }
    } elseif ($sAction == "prestamo" || $sAction == "prestamoIndefinido" || $sAction == "delete" || $sAction == "devolucion") {
        // Inicializa par�metros para SQL
        $fldPRES_FECH = $db->conn->OffsetDate(0, $db->conn->sysTimeStamp);
        $fldPRES_ID = get_param("s_PRES_ID");
        $sfldPRES_ID = str_replace("'", "", "" . tosql($fldPRES_ID, "Text"));
        // identifiador de los registros
        $estadoOld = "=1";
        // Pr�stamo
        if ($sAction == "prestamoIndefinido" || $sAction == "prestamo") {
            $fldDESC = tosql(get_param("observa"), "Text");
            $setFecha = "PRES_FECH_PRES=" . $fldPRES_FECH . ", PRES_DESC=" . $fldDESC . ", USUA_LOGIN_PRES='" . $krd . "' ";
            $nombTx = "Prestar Documento";
            if ($sAction == "prestamoIndefinido") {
                $estadoNew = 5;
                $titError = "El registro del pr&eacute;stamo indefinido no pudo ser realizado";
            } else {
                $estadoNew = 2;
                $fechaVencimiento = get_param("fechaVencimiento");
                $sqlFechaVenc = $db->conn->DBDate($fechaVencimiento);
                $setFecha .= ",PRES_FECH_VENC=" . $sqlFechaVenc . " ";
                $titError = "El registro del pr&eacute;stamo no pudo ser realizado";
            }
        } elseif ($sAction == "delete") {
            $estadoNew = 4;
            $setFecha = "PRES_FECH_CANC=" . $fldPRES_FECH . ", USUA_LOGIN_CANC='" . $krd . "'";
            $nombTx = "Cancelar Solicitud de Pr&eacute;stamo";
            $titError = "El registro de la cancelaci�n no pudo ser realizado";
        } elseif ($sAction == "devolucion") {
            $estadoNew = 3;
            $fldDESC = tosql(get_param("observa"), "Text");
            $setFecha = "PRES_FECH_DEVO=" . $fldPRES_FECH . ", DEV_DESC=" . $fldDESC . ", USUA_LOGIN_RX='" . $krd . "' ";
            $nombTx = "Devolver Documento";
            $titError = "El registro de la devoluci�n no pudo ser realizado";
            $estadoOld = "in (2,5)";
        }
        $fecha = date("d-m-Y  h:i A");
        // Create SQL statement
        $sSQL = "update PRESTAMO set " . $setFecha . ",PRES_ESTADO=" . $estadoNew . " \n\t\t\t   where PRES_ID in (" . $sfldPRES_ID . ") and PRES_ESTADO " . $estadoOld;
        // Execute SQL statement
        if ($db->conn->query($sSQL)) {
            verMensaje($nombTx, $fecha);
        } else {
            echo "<script> alert(" . $titError . "); </script>";
        }
    }
}
Пример #11
0
function RADICADO_show()
{
    //-------------------------------
    // Initialize variables
    //-------------------------------
    global $db;
    global $sRADICADOErr;
    global $sFileName;
    global $styles;
    $sWhere = "";
    $sOrder = "";
    $sSQL = "";
    $sFormTitle = "Reporte";
    $HasParam = false;
    $bReq = true;
    $iRecordsPerPage = 2000;
    $iCounter = 0;
    $iSort = "";
    $iSorted = "";
    $sDirection = "";
    $sSortParams = "";
    $iTmpI = 0;
    $iTmpJ = 0;
    $sCountSQL = "";
    $transit_params = "";
    $form_params = "s_RADI_DEPE_RADI=" . tourl(get_param("s_RADI_DEPE_RADI")) . "&s_desde_RADI_FECH_RADI=" . tourl(get_param("s_desde_RADI_FECH_RADI")) . "&s_hasta_RADI_FECH_RADI=" . tourl(get_param("s_hasta_RADI_FECH_RADI")) . "&";
    //-------------------------------
    // Build ORDER BY statement
    //-------------------------------
    $sOrder = " order by R.RADI_NUME_RADI Asc";
    $iSort = get_param("FormRADICADO_Sorting");
    $iSorted = get_param("FormRADICADO_Sorted");
    if (!$iSort) {
        $form_sorting = "";
    } else {
        if ($iSort == $iSorted) {
            $form_sorting = "";
            $sDirection = " DESC";
            $sSortParams = "FormRADICADO_Sorting=" . $iSort . "&FormRADICADO_Sorted=" . $iSort . "&";
        } else {
            $form_sorting = $iSort;
            $sDirection = " ASC";
            $sSortParams = "FormRADICADO_Sorting=" . $iSort . "&FormRADICADO_Sorted=" . "&";
        }
        if ($iSort == 1) {
            $sOrder = " order by R.RADI_NUME_RADI" . $sDirection;
        }
        if ($iSort == 2) {
            $sOrder = " order by R.RA_ASUN" . $sDirection;
        }
        if ($iSort == 3) {
            $sOrder = " order by R.RADI_FECH_RADI" . $sDirection;
        }
        if ($iSort == 4) {
            $sOrder = " order by R.RADI_NUME_HOJA" . $sDirection;
        }
        if ($iSort == 5) {
            $sOrder = " order by R.RADI_DESC_ANEX" . $sDirection;
        }
    }
    //-------------------------------
    // HTML column headers
    //-------------------------------
    ?>
     
<table class="FormTABLE" width="715">
  <tr>
       <td class="FormHeaderTD" colspan="5"><a name="RADICADO"><font class="FormHeaderFONT"><?php 
    echo $sFormTitle;
    ?>
</font></a></td>
  </tr>
      
  <tr align="center"> 
    <td class="ColumnTD" height="25" width="85"><a href="<?php 
    echo $sFileName;
    ?>
?<?php 
    echo $form_params;
    ?>
FormRADICADO_Sorting=1&FormRADICADO_Sorted=<?php 
    echo $form_sorting;
    ?>
&"><font class="ColumnFONT">Radicado</font></a></td>
       
    <td class="ColumnTD" height="25" width="331"><a href="<?php 
    echo $sFileName;
    ?>
?<?php 
    echo $form_params;
    ?>
FormRADICADO_Sorting=2&FormRADICADO_Sorted=<?php 
    echo $form_sorting;
    ?>
&"><font class="ColumnFONT">Asunto</font></a></td>
       
    <td class="ColumnTD" width="110" height="25"><a href="<?php 
    echo $sFileName;
    ?>
?<?php 
    echo $form_params;
    ?>
FormRADICADO_Sorting=3&FormRADICADO_Sorted=<?php 
    echo $form_sorting;
    ?>
&"><font class="ColumnFONT">Fecha 
      Radicaci&oacute;n</font></a></td>
       
    <td class="ColumnTD" height="25" width="23"><a href="<?php 
    echo $sFileName;
    ?>
?<?php 
    echo $form_params;
    ?>
FormRADICADO_Sorting=4&FormRADICADO_Sorted=<?php 
    echo $form_sorting;
    ?>
&"><font class="ColumnFONT"># H</font></a>oj</td>
       
    <td width="142" height="25" class="ColumnTD"><a href="<?php 
    echo $sFileName;
    ?>
?<?php 
    echo $form_params;
    ?>
FormRADICADO_Sorting=5&FormRADICADO_Sorted=<?php 
    echo $form_sorting;
    ?>
&"><font class="ColumnFONT">Anexos</font></a></td>
  </tr>
<?php 
    //-------------------------------
    // Build WHERE statement
    //-------------------------------
    $ps_desde_RADI_FECH_RADI = get_param("s_desde_RADI_FECH_RADI");
    $ps_hora_inicial = get_param("s_hora_inicial");
    $ps_hora_final = get_param("s_hora_final");
    if (strlen($ps_desde_RADI_FECH_RADI) && strlen($ps_hora_inicial) && strlen($ps_hora_final)) {
        $ps_hora_final -= 1;
        $desde = $ps_desde_RADI_FECH_RADI . " " . $ps_hora_inicial . ":00:00";
        $hasta = $ps_desde_RADI_FECH_RADI . " " . $ps_hora_final . ":59:59";
        $HasParam = true;
        $sWhere = $sWhere . "R.RADI_FECH_RADI>=to_date('" . $desde . "','dd/mm/yyyy HH24:MI:ss')";
        $sWhere .= " and ";
        $sWhere = $sWhere . "R.RADI_FECH_RADI<=to_date('" . $hasta . "','dd/mm/yyyy HH24:MI:ss')";
    }
    $ps_RADI_DEPE_RADI = get_param("s_RADI_DEPE_RADI");
    if (is_number($ps_RADI_DEPE_RADI) && strlen($ps_RADI_DEPE_RADI)) {
        $ps_RADI_DEPE_RADI = tosql($ps_RADI_DEPE_RADI, "Number");
    } else {
        $ps_RADI_DEPE_RADI = "";
    }
    if (strlen($ps_RADI_DEPE_RADI)) {
        if ($sWhere != "") {
            $sWhere .= " and ";
        }
        $HasParam = true;
        //se busca en el radicado donde sea like 'yyyyDEP%'
        $sWhere = $sWhere . "R.RADI_NUME_RADI LIKE '" . substr($ps_desde_RADI_FECH_RADI, 6, 4) . $ps_RADI_DEPE_RADI . "%'";
    } else {
        $bReq = false;
    }
    if ($HasParam) {
        $sWhere = " WHERE (" . $sWhere . ")";
    }
    //-------------------------------
    // Build base SQL statement
    //-------------------------------
    $sSQL = "select R.RADI_DEPE_RADI as R_RADI_DEPE_RADI, " . "R.RADI_DESC_ANEX as R_RADI_DESC_ANEX, " . "to_char(R.RADI_FECH_RADI,'dd/mm/yyyy hh24:mi:ss') as R_RADI_FECH_RADI, " . "R.RADI_NUME_HOJA as R_RADI_NUME_HOJA, " . "R.RADI_NUME_RADI as R_RADI_NUME_RADI, " . "R.RA_ASUN as R_RA_ASUN " . " from RADICADO R ";
    //-------------------------------
    //-------------------------------
    // RADICADO Open Event begin
    $sSQLCount = "Select count(*) as Total from radicado R " . $sWhere;
    $db->query($sSQLCount);
    $next_record = $db->next_record();
    $fldTotal = $db->f("TOTAL");
    // RADICADO Open Event end
    //-------------------------------
    //-------------------------------
    // Assemble full SQL statement
    //-------------------------------
    $sSQL .= $sWhere . $sOrder;
    if ($sCountSQL == "") {
        $iTmpI = strpos(strtolower($sSQL), "select");
        $iTmpJ = strpos(strtolower($sSQL), "from") - 1;
        $sCountSQL = str_replace(substr($sSQL, $iTmpI + 6, $iTmpJ - $iTmpI - 6), " count(*) ", $sSQL);
        $iTmpI = strpos(strtolower($sCountSQL), "order by");
        if ($iTmpI > 1) {
            $sCountSQL = substr($sCountSQL, 0, $iTmpI - 1);
        }
    }
    //-------------------------------
    //-------------------------------
    // Process if form has all required parameters
    //-------------------------------
    if (!$bReq) {
        ?>
     <tr>
      
    <td colspan="5" class="DataTD" height="25"><font class="DataFONT">No records</font></td>
     </tr>
</table>
<?php 
        return;
    }
    //-------------------------------
    //-------------------------------
    // Execute SQL statement
    //-------------------------------
    $db->query($sSQL);
    $next_record = $db->next_record();
    //-------------------------------
    // Process empty recordset
    //-------------------------------
    if (!$next_record) {
        ?>
     <tr>
      <td colspan="5" class="DataTD"><font class="DataFONT">No records</font></td>
     </tr>
<?php 
        ?>
  </table>
<?php 
        return;
    }
    //-------------------------------
    ?>
     <tr>
      <td colspan="5" class="DataTD"><font class="DataFONT"><b>Total Registros: <?php 
    echo $fldTotal;
    ?>
</b></font></td>
     </tr>

<?php 
    //-------------------------------
    // Initialize page counter and records per page
    //-------------------------------
    $iRecordsPerPage = 2000;
    $iCounter = 0;
    //-------------------------------
    //-------------------------------
    // Display grid based on recordset
    //-------------------------------
    while ($next_record && $iCounter < $iRecordsPerPage) {
        //-------------------------------
        // Create field variables based on database fields
        //-------------------------------
        $fldRA_ASUN = $db->f("R_RA_ASUN");
        $fldRADI_DESC_ANEX = $db->f("R_RADI_DESC_ANEX");
        $fldRADI_FECH_RADI = $db->f("R_RADI_FECH_RADI");
        $fldRADI_NUME_HOJA = $db->f("R_RADI_NUME_HOJA");
        $fldRADI_NUME_RADI = $db->f("R_RADI_NUME_RADI");
        $next_record = $db->next_record();
        //-------------------------------
        // RADICADO Show begin
        //-------------------------------
        //-------------------------------
        // RADICADO Show Event begin
        // RADICADO Show Event end
        //-------------------------------
        //-------------------------------
        // Process the HTML controls
        //-------------------------------
        ?>
      <tr>
       <td class="DataTD"><font class="DataFONT">
      <?php 
        echo tohtml($fldRADI_NUME_RADI);
        ?>
&nbsp;</font></td>
       <td class="DataTD"><font class="DataFONT">
      <?php 
        echo tohtml($fldRA_ASUN);
        ?>
&nbsp;</font></td>
       <td class="DataTD"><font class="DataFONT">
      <?php 
        echo tohtml($fldRADI_FECH_RADI);
        ?>
&nbsp;</font></td>
       <td class="DataTD"><font class="DataFONT">
      <?php 
        echo tohtml($fldRADI_NUME_HOJA);
        ?>
&nbsp;</font></td>
       <td class="DataTD"><font class="DataFONT">
      <?php 
        echo tohtml($fldRADI_DESC_ANEX);
        ?>
&nbsp;</font></td>
      </tr><?php 
        //-------------------------------
        // RADICADO Show end
        //-------------------------------
        //-------------------------------
        // Move to the next record and increase record counter
        //-------------------------------
        $iCounter++;
    }
    //-------------------------------
    // Finish form processing
    //-------------------------------
    ?>
    </table>
  <?php 
    //-------------------------------
    // RADICADO Close Event begin
    // RADICADO Close Event end
    //-------------------------------
}
     		//adding a new field if one has been entered
     		if($new_custom_field_id > 0 && $new_custom_field_data != '') {
     			$custom_discipline_insert_sql = "INSERT into custom_media_history SET 
     				custom_field_id = '$new_custom_field_id', 
     				media_history_id = '$disid',
     				data = '$new_custom_field_data'";
     			$db->query($custom_discipline_insert_sql);
     		} //end custom fields
     */
     $url = "admin_manage_media_2.php?studentid=" . $studentid . "&disid=" . $disid;
     header("Location: {$url}");
     exit;
 } else {
     $sschool = get_param("sschool");
     $notify = get_param("notify");
     $sSQL = "INSERT INTO media_history (media_history_student, media_history_school, media_history_year, media_history_code, media_history_dateout, media_history_datedue, media_history_dateret, media_history_action, media_history_notes, media_history_reporter, media_history_user) VALUES ({$studentid}, {$sschool}, {$current_year}, {$discode}, '{$disdate}', '{$sdate}', '{$edate}', " . tosql($disaction, "Text") . ", " . tosql($disnotes, "Text") . ", " . tosql($disreporter, "Text") . ", {$web_user})";
     $db->query($sSQL);
     /* here was the mailer code to notify parents.  Should we ever want it
     again, paste from admin_manage_discipline accordingly. */
     /* Yeah, I did, cos I think it's a great feature! :-) */
     if ($notify == 1) {
         $sSQL = "SELECT studentcontact.studentcontact_email, studentcontact.studentcontact_fname, \r\n\t\t\tstudentcontact.studentcontact_lname, contact_to_students.contact_to_students_student \r\n\t\t\tFROM contact_to_students \r\n\t\t\tINNER JOIN studentcontact ON contact_to_students.contact_to_students_contact = studentcontact.studentcontact_id \r\n\t\t\tWHERE contact_to_students_student={$studentid}";
         if ($addresses = $db->get_results($sSQL)) {
             $sSQL = "SELECT studentbio_fname, studentbio_lname FROM studentbio WHERE studentbio_id={$studentid}";
             $student = $db->get_row($sSQL);
             $sfname = $student->studentbio_fname;
             $slname = $student->studentbio_lname;
             require_once "class.phpmailer.php";
             $mail = new PHPMailer();
             $mail->SetLanguage(_LANG, ".");
             //                      //      $mail->IsSMTP();                   // send via SMTP
            $db->query($custom_attendance_update_sql);
        }
    }
    //adding a new field if one has been entered
    if ($new_custom_field_id > 0 && $new_custom_field_data != '') {
        $custom_attendance_insert_sql = "INSERT into custom_attendance_history SET \n\t\t\tcustom_field_id = '{$new_custom_field_id}', \n\t\t\tattendance_history_id = '{$attid}',\n\t\t\tdata = '{$new_custom_field_data}'";
        $db->query($custom_attendance_insert_sql);
    }
    //end custom fields
    $url = "admin_manage_attendance_2.php?studentid=" . $studentid . "&attid=" . $attid;
    header("Location: {$url}");
    exit;
} else {
    $sschool = get_param("sschool");
    $notify = get_param("notify");
    $sSQL = "INSERT INTO attendance_history (attendance_history_student, attendance_history_school, attendance_history_year, attendance_history_date, attendance_history_code, attendance_history_notes, attendance_history_user) VALUES ({$studentid}, {$sschool}, {$current_year}, '{$attdate}', {$attcode}, " . tosql($attnotes, "Text") . ", {$web_user})";
    $db->query($sSQL);
    if ($notify == 1) {
        $sSQL = "SELECT studentcontact.studentcontact_email, studentcontact.studentcontact_fname, studentcontact.studentcontact_lname, contact_to_students.contact_to_students_student FROM contact_to_students INNER JOIN studentcontact ON contact_to_students.contact_to_students_contact = studentcontact.studentcontact_id WHERE contact_to_students_student={$studentid}";
        if ($addresses = $db->get_results($sSQL)) {
            $sSQL = "SELECT studentbio_fname, studentbio_lname FROM studentbio WHERE studentbio_id={$studentid}";
            $student = $db->get_row($sSQL);
            $sfname = $student->studentbio_fname;
            $slname = $student->studentbio_lname;
            require_once "class.phpmailer.php";
            $mail = new PHPMailer();
            //			$mail->IsSMTP();                                   // send via SMTP
            //			$mail->Host     = SMTP_SERVER; // SMTP servers
            //			$mail->SMTPAuth = true;     // turn on SMTP authentication
            //			$mail->Username = SMTP_USER;  // SMTP username
            //			$mail->Password = SMTP_PASSWORD; // SMTP password
             $db->query($custom_discipline_update_sql);
         }
     }
     //adding a new field if one has been entered
     if ($new_custom_field_id > 0 && $new_custom_field_data != '') {
         $custom_discipline_insert_sql = "INSERT into custom_discipline_history SET \r\n\t\t\t\tcustom_field_id = '{$new_custom_field_id}', \r\n\t\t\t\tdiscipline_history_id = '{$disid}',\r\n\t\t\t\tdata = '{$new_custom_field_data}'";
         $db->query($custom_discipline_insert_sql);
     }
     //end custom fields
     $url = "admin_manage_discipline_2.php?studentid=" . $studentid . "&disid=" . $disid;
     header("Location: {$url}");
     exit;
 } else {
     $sschool = get_param("sschool");
     $notify = get_param("notify");
     $sSQL = "INSERT INTO discipline_history (discipline_history_student, discipline_history_school, discipline_history_year, discipline_history_code, discipline_history_date, discipline_history_sdate, discipline_history_edate, discipline_history_action, discipline_history_notes, discipline_history_reporter, discipline_history_user) VALUES ('" . $studentid . "', '" . $sschool . "', '" . $current_year . "', {$discode}, '{$disdate}', '{$sdate}', '{$edate}', " . tosql($disaction, "Text") . ", " . tosql($disnotes, "Text") . ", " . tosql($disreporter, "Text") . ", '" . $web_user . "')";
     // echo $sSQL; exit;
     $db->query($sSQL);
     if ($notify == 1) {
         $sSQL = "SELECT studentcontact.studentcontact_email, studentcontact.studentcontact_fname, studentcontact.studentcontact_lname, contact_to_students.contact_to_students_student FROM contact_to_students INNER JOIN studentcontact ON contact_to_students.contact_to_students_contact = studentcontact.studentcontact_id WHERE contact_to_students_student={$studentid}";
         if ($addresses = $db->get_results($sSQL)) {
             $sSQL = "SELECT studentbio_fname, studentbio_lname FROM studentbio WHERE studentbio_id={$studentid}";
             $student = $db->get_row($sSQL);
             $sfname = $student->studentbio_fname;
             $slname = $student->studentbio_lname;
             require_once "class.phpmailer.php";
             $mail = new PHPMailer();
             //			//	$mail->IsSMTP();                   // send via SMTP
             //			//	$mail->Host     = SMTP_SERVER; // SMTP servers
             //			//	$mail->SMTPAuth = true;     // turn on SMTP authentication
             //			//	$mail->Username = SMTP_USER;  // SMTP username
Пример #15
0
        $health_codes_id = get_param("id");
        if ($norem = $db->get_results("SELECT health_history_code FROM health_history WHERE health_history_code='" . $health_codes_id . "'")) {
            $msgFormErr = _HEALTH_CODES_NOT_REMOVED;
        } else {
            $sSQL = "DELETE FROM health_codes WHERE health_codes_id='" . $health_codes_id . "'";
            $db->query($sSQL);
        }
        break;
    case "add":
        $health_codes_desc = get_param("healthname");
        //Check for duplicates
        $tot = $db->get_var("SELECT count(*) FROM health_codes WHERE health_codes_desc='{$health_codes_desc}'");
        if ($tot > 0) {
            $msgFormErr = _HEALTH_CODES_DUP;
        } else {
            $sSQL = "INSERT INTO health_codes (health_codes_desc) VALUES (" . tosql($health_codes_desc, "Text") . ")";
            $db->query($sSQL);
        }
        break;
    case "edit":
        $health_codes_id = get_param("id");
        $sSQL = "SELECT health_codes_desc FROM health_codes WHERE health_codes_id='" . $health_codes_id . "'";
        $health_codes_desc = $db->get_var($sSQL);
        break;
    case "update":
        $health_codes_id = get_param("id");
        $health_codes_desc = get_param("healthname");
        $sSQL = "UPDATE health_codes SET health_codes_desc='{$health_codes_desc}' WHERE health_codes_id='" . $health_codes_id . "'";
        $db->query($sSQL);
        break;
}
Пример #16
0
function OtrasEmpresas_show()
{
    //-------------------------------
    // Initialize variables
    //-------------------------------
    global $db;
    global $sRADICADOErr;
    global $sFileName;
    global $styles;
    $sWhere = "";
    $sOrder = "";
    $sSQL = "";
    $sFormTitle = "Radicados encontrados por Otras Empresas";
    $HasParam = false;
    $iRecordsPerPage = 25;
    $iCounter = 0;
    $iPage = 0;
    $bEof = false;
    $iSort = "";
    $iSorted = "";
    $sDirection = "";
    $sSortParams = "";
    $iTmpI = 0;
    $iTmpJ = 0;
    $sCountSQL = "";
    $transit_params = "";
    $form_params = trim(session_name()) . "=" . trim(session_id()) . "&krd={$krd}&s_RADI_DEPE_ACTU=" . tourl(get_param("s_RADI_DEPE_ACTU")) . "&s_RADI_NOMB=" . tourl(get_param("s_RADI_NOMB")) . "&s_RADI_NUME_RADI=" . tourl(get_param("s_RADI_NUME_RADI")) . "&s_TDOC_CODI=" . tourl(get_param("s_TDOC_CODI")) . "&s_desde_dia=" . tourl(get_param("s_desde_dia")) . "&s_desde_mes=" . tourl(get_param("s_desde_mes")) . "&s_desde_ano=" . tourl(get_param("s_desde_ano")) . "&s_hasta_dia=" . tourl(get_param("s_hasta_dia")) . "&s_hasta_mes=" . tourl(get_param("s_hasta_mes")) . "&s_hasta_ano=" . tourl(get_param("s_hasta_ano")) . "&s_solo_nomb=" . tourl(get_param("s_solo_nomb")) . "&s_ciudadano=" . tourl(get_param("s_ciudadano")) . "&s_empresaESP=" . tourl(get_param("s_empresaESP")) . "&s_oEmpresa=" . tourl(get_param("s_oEmpresa")) . "&s_entrada=" . tourl(get_param("s_entrada")) . "&s_salida=" . tourl(get_param("s_salida")) . "&";
    //-------------------------------
    // Build ORDER BY statement
    //-------------------------------
    $sOrder = " order by R.RADI_NUME_RADI Asc";
    $iSort = get_param("FormOEMPRESAS_Sorting");
    $iSorted = get_param("FormOEMPRESAS_Sorted");
    $krd = strip(get_param("krd"));
    if (!$iSort) {
        $form_sorting = "";
    } else {
        if ($iSort == $iSorted) {
            $form_sorting = "";
            $sDirection = " DESC ";
            $sSortParams = "FormOEMPRESAS_Sorting=" . $iSort . "&FormOEMPRESAS_Sorted=" . $iSort . "&";
        } else {
            $form_sorting = $iSort;
            $sDirection = " ASC ";
            $sSortParams = "FormOEMPRESAS_Sorting=" . $iSort . "&FormOEMPRESAS_Sorted=" . "&";
        }
        if ($iSort == 1) {
            $sOrder = " order by r.radi_nume_radi" . $sDirection;
        }
        if ($iSort == 2) {
            $sOrder = " order by r.radi_fech_radi" . $sDirection;
        }
        if ($iSort == 3) {
            $sOrder = " order by r.ra_asun" . $sDirection;
        }
        if ($iSort == 4) {
            $sOrder = " order by td.sgd_tpr_descrip" . $sDirection;
        }
        if ($iSort == 5) {
            $sOrder = " order by r.radi_nume_hoja" . $sDirection;
        }
        if ($iSort == 6) {
            $sOrder = " order by dir.sgd_dir_direccion" . $sDirection;
        }
        if ($iSort == 7) {
            $sOrder = " order by dir.sgd_dir_telefono" . $sDirection;
        }
        if ($iSort == 8) {
            $sOrder = " order by dir.sgd_dir_mail" . $sDirection;
        }
        if ($iSort == 9) {
            $sOrder = " order by o.sgd_oem_oempresa" . $sDirection;
        }
        if ($iSort == 10) {
            $sOrder = " order by o.sgd_oem_rep_legal" . $sDirection;
        }
        if ($iSort == 11) {
            $sOrder = " order by o.sgd_oem_nit" . $sDirection;
        }
        if ($iSort == 12) {
            $sOrder = " order by o.sgd_oem_sigla" . $sDirection;
        }
        if ($iSort == 13) {
            $sOrder = " order by o.sgd_oem_direccion" . $sDirection;
        }
        if ($iSort == 14) {
            $sOrder = " order by o.sgd_oem_telefono" . $sDirection;
        }
        if ($iSort == 15) {
            $sOrder = " order by u1.usua_nomb" . $sDirection;
        }
        if ($iSort == 16) {
            $sOrder = " order by d1.depe_nomb" . $sDirection;
        }
        if ($iSort == 17) {
            $sOrder = " order by r.radi_usu_ante" . $sDirection;
        }
        //    if ($iSort == 18) $sOrder = " order by muni.muni_nomb" . $sDirection;
        //    if ($iSort == 19) $sOrder = " order by dpto.dpto_nomb" . $sDirection;
        if ($iSort == 20) {
            $sOrder = " order by r.radi_pais" . $sDirection;
        }
        if ($iSort == 21) {
            $sOrder = " order by diasr" . $sDirection;
        }
        if ($iSort == 22) {
            $sOrder = " order by dir.sgd_dir_nombre" . $sDirection;
        }
    }
    //-------------------------------
    // Encabezados HTML de las Columnas
    //-------------------------------
    ?>
     <table width="2000" class="FormTABLE">
      <tr>
       <td class="FormHeaderTD" colspan="20"><a name="RADICADO"><font class="FormHeaderFONT"><?php 
    echo $sFormTitle;
    ?>
</font></a></td>
      </tr>
      <tr>
	   <td class="ColumnTD"><a href="<?php 
    echo $sFileName;
    ?>
?<?php 
    echo $form_params;
    ?>
FormOEMPRESAS_Sorting=1&FormOEMPRESAS_Sorted=<?php 
    echo $form_sorting;
    ?>
&"><font class="ColumnFONT">Radicado</font></a></td>
       <td class="ColumnTD"><a href="<?php 
    echo $sFileName;
    ?>
?<?php 
    echo $form_params;
    ?>
FormOEMPRESAS_Sorting=2&FormOEMPRESAS_Sorted=<?php 
    echo $form_sorting;
    ?>
&"><font class="ColumnFONT">Fecha Radicación</font></a></td>
       <td class="ColumnTD"><a href="<?php 
    echo $sFileName;
    ?>
?<?php 
    echo $form_params;
    ?>
FormOEMPRESAS_Sorting=3&FormOEMPRESAS_Sorted=<?php 
    echo $form_sorting;
    ?>
&"><font class="ColumnFONT">Asunto</font></a></td>
       <td class="ColumnTD"><a href="<?php 
    echo $sFileName;
    ?>
?<?php 
    echo $form_params;
    ?>
FormOEMPRESAS_Sorting=4&FormOEMPRESAS_Sorted=<?php 
    echo $form_sorting;
    ?>
&"><font class="ColumnFONT">Tipo de Documento</font></a></td>	   
       <td class="ColumnTD"><a href="<?php 
    echo $sFileName;
    ?>
?<?php 
    echo $form_params;
    ?>
FormOEMPRESAS_Sorting=5&FormOEMPRESAS_Sorted=<?php 
    echo $form_sorting;
    ?>
&"><font class="ColumnFONT">Numero de Hojas</font></a></td>	   
       <td class="ColumnTD"><a href="<?php 
    echo $sFileName;
    ?>
?<?php 
    echo $form_params;
    ?>
FormOEMPRESAS_Sorting=6&FormOEMPRESAS_Sorted=<?php 
    echo $form_sorting;
    ?>
&"><font class="ColumnFONT">Direccion contacto</font></a></td>
       <td class="ColumnTD"><a href="<?php 
    echo $sFileName;
    ?>
?<?php 
    echo $form_params;
    ?>
FormOEMPRESAS_Sorting=7&FormOEMPRESAS_Sorted=<?php 
    echo $form_sorting;
    ?>
&"><font class="ColumnFONT">Teléfono contacto</font></a></td>
       <td class="ColumnTD"><a href="<?php 
    echo $sFileName;
    ?>
?<?php 
    echo $form_params;
    ?>
FormOEMPRESAS_Sorting=8&FormOEMPRESAS_Sorted=<?php 
    echo $form_sorting;
    ?>
&"><font class="ColumnFONT">Mail Contacto</font></a></td>
	   <td class="ColumnTD"><a href="<?php 
    echo $sFileName;
    ?>
?<?php 
    echo $form_params;
    ?>
FormOEMPRESAS_Sorting=9&FormOEMPRESAS_Sorted=<?php 
    echo $form_sorting;
    ?>
&"><font class="ColumnFONT">Nombre de la Empresa</font></a></td>
       <td class="ColumnTD"><a href="<?php 
    echo $sFileName;
    ?>
?<?php 
    echo $form_params;
    ?>
FormOEMPRESAS_Sorting=10&FormOEMPRESAS_Sorted=<?php 
    echo $form_sorting;
    ?>
&"><font class="ColumnFONT">Representante Legal</font></a></td>
       <td class="ColumnTD"><a href="<?php 
    echo $sFileName;
    ?>
?<?php 
    echo $form_params;
    ?>
FormOEMPRESAS_Sorting=11&FormOEMPRESAS_Sorted=<?php 
    echo $form_sorting;
    ?>
&"><font class="ColumnFONT">NIT</font></a></td>
       <td class="ColumnTD"><a href="<?php 
    echo $sFileName;
    ?>
?<?php 
    echo $form_params;
    ?>
FormOEMPRESAS_Sorting=12&FormOEMPRESAS_Sorted=<?php 
    echo $form_sorting;
    ?>
&"><font class="ColumnFONT">Sigla</font></a></td>
       <td class="ColumnTD"><a href="<?php 
    echo $sFileName;
    ?>
?<?php 
    echo $form_params;
    ?>
FormOEMPRESAS_Sorting=13&FormOEMPRESAS_Sorted=<?php 
    echo $form_sorting;
    ?>
&"><font class="ColumnFONT">Direccion Empresa</font></a></td>
       <td class="ColumnTD"><a href="<?php 
    echo $sFileName;
    ?>
?<?php 
    echo $form_params;
    ?>
FormOEMPRESAS_Sorting=14&FormOEMPRESAS_Sorted=<?php 
    echo $form_sorting;
    ?>
&"><font class="ColumnFONT">Telefono</font></a></td>
       <td class="ColumnTD"><a href="<?php 
    echo $sFileName;
    ?>
?<?php 
    echo $form_params;
    ?>
FormOEMPRESAS_Sorting=15&FormOEMPRESAS_Sorted=<?php 
    echo $form_sorting;
    ?>
&"><font class="ColumnFONT">Usuario Actual</font></a></td>
       <td class="ColumnTD"><a href="<?php 
    echo $sFileName;
    ?>
?<?php 
    echo $form_params;
    ?>
FormOEMPRESAS_Sorting=16&FormOEMPRESAS_Sorted=<?php 
    echo $form_sorting;
    ?>
&"><font class="ColumnFONT">Dependencia Actual</font></a></td>
       <td class="ColumnTD"><a href="<?php 
    echo $sFileName;
    ?>
?<?php 
    echo $form_params;
    ?>
FormOEMPRESAS_Sorting=17&FormOEMPRESAS_Sorted=<?php 
    echo $form_sorting;
    ?>
&"><font class="ColumnFONT">Usuario Anterior</font></a></td>
	   <td class="ColumnTD"><a href="<?php 
    echo $sFileName;
    ?>
?<?php 
    echo $form_params;
    ?>
FormCIUDADANO_Sorting=22&FormCIUDADANO_Sorted=<?php 
    echo $form_sorting;
    ?>
&"><font class="ColumnFONT">Firmante</font></a></td>
	   <!--td class="ColumnTD"><a href="<?php 
    echo $sFileName;
    ?>
?<?php 
    echo $form_params;
    ?>
FormOEMPRESAS_Sorting=18&FormOEMPRESAS_Sorted=<?php 
    echo $form_sorting;
    ?>
&"><font class="ColumnFONT">Municipio</font></a></td>
	   <td class="ColumnTD"><a href="<?php 
    echo $sFileName;
    ?>
?<?php 
    echo $form_params;
    ?>
FormOEMPRESAS_Sorting=19&FormOEMPRESAS_Sorted=<?php 
    echo $form_sorting;
    ?>
&"><font class="ColumnFONT">Departamento</font></a></td-->
	   <td class="ColumnTD"><a href="<?php 
    echo $sFileName;
    ?>
?<?php 
    echo $form_params;
    ?>
FormOEMPRESAS_Sorting=20&FormOEMPRESAS_Sorted=<?php 
    echo $form_sorting;
    ?>
&"><font class="ColumnFONT">Pais</font></a></td>
  	   <td class="ColumnTD"><a href="<?php 
    echo $sFileName;
    ?>
?<?php 
    echo $form_params;
    ?>
FormOEMPRESAS_Sorting=21&FormOEMPRESAS_Sorted=<?php 
    echo $form_sorting;
    ?>
&"><font class="ColumnFONT">Dias Restantes</font></a></td>
      </tr>
<?php 
    //-------------------------------
    // Build WHERE statement
    //-------------------------------
    // Se crea la $ps_desde_RADI_FECH_RADI con los datos ingresados.
    //------------------------------------
    $ps_desde_RADI_FECH_RADI = Date('d/m/Y H:i:s', mktime(0, 0, 0, get_param("s_desde_mes"), get_param("s_desde_dia"), get_param("s_desde_ano")));
    $ps_hasta_RADI_FECH_RADI = Date('d/m/Y H:i:s', mktime(23, 59, 59, get_param("s_hasta_mes"), get_param("s_hasta_dia"), get_param("s_hasta_ano")));
    if (strlen($ps_desde_RADI_FECH_RADI) && strlen($ps_hasta_RADI_FECH_RADI)) {
        $HasParam = true;
        $sWhere = $sWhere . "r.radi_fech_radi>=to_date('" . $ps_desde_RADI_FECH_RADI . "','dd/mm/yyyy hh24:mi:ss')";
        $sWhere .= " and ";
        $sWhere = $sWhere . "r.radi_fech_radi<=to_date('" . $ps_hasta_RADI_FECH_RADI . "','dd/mm/yyyy hh24:mi:ss')";
    }
    /* Se recibe la dependencia actual para búsqueda */
    $ps_RADI_DEPE_ACTU = get_param("s_RADI_DEPE_ACTU");
    if (is_number($ps_RADI_DEPE_ACTU) && strlen($ps_RADI_DEPE_ACTU)) {
        $ps_RADI_DEPE_ACTU = tosql($ps_RADI_DEPE_ACTU, "Number");
    } else {
        $ps_RADI_DEPE_ACTU = "";
    }
    if (strlen($ps_RADI_DEPE_ACTU)) {
        if ($sWhere != "") {
            $sWhere .= " and ";
        }
        $HasParam = true;
        $sWhere = $sWhere . "r.radi_depe_actu=" . $ps_RADI_DEPE_ACTU;
    }
    /* Se recibe el número del radicado para búsqueda */
    $ps_RADI_NUME_RADI = get_param("s_RADI_NUME_RADI");
    if (strlen($ps_RADI_NUME_RADI)) {
        if ($sWhere != "") {
            $sWhere .= " and ";
        }
        $HasParam = true;
        $sWhere = $sWhere . "r.radi_nume_radi like " . tosql("%" . $ps_RADI_NUME_RADI . "%", "Text");
    }
    /* Se decide si busca en radicado de entrada o de salida o ambos */
    $ps_entrada = strip(get_param("s_entrada"));
    if (strlen($ps_entrada) && ($ps_entrada = "ENT")) {
        if ($sWhere != "") {
            $sWhere .= " and ";
        }
        $HasParam = true;
        $sWhere = $sWhere . "r.radi_nume_radi like " . tosql("%2", "Text");
    }
    $ps_salida = strip(get_param("s_salida"));
    if (strlen($ps_salida) && ($ps_salida = "SAL")) {
        if ($sWhere != "") {
            $sWhere .= " and ";
        }
        $HasParam = true;
        $sWhere = $sWhere . "r.radi_nume_radi like " . tosql("%1", "Text");
    }
    /* Se recibe el tipo de documento para la búsqueda */
    $ps_TDOC_CODI = get_param("s_TDOC_CODI");
    if (is_number($ps_TDOC_CODI) && strlen($ps_TDOC_CODI) && $ps_TDOC_CODI != "9999") {
        $ps_TDOC_CODI = tosql($ps_TDOC_CODI, "Number");
    } else {
        $ps_TDOC_CODI = "";
    }
    if (strlen($ps_TDOC_CODI)) {
        if ($sWhere != "") {
            $sWhere .= " and ";
        }
        $HasParam = true;
        $sWhere = $sWhere . "r.tdoc_codi=" . $ps_TDOC_CODI;
    }
    /* Se recibe la caadena a buscar y el tipo de busqueda (All) (Any)  
     bod.nombre_de_la_empresa,bod.nombre_rep_legal,bod.nit_de_la_empresa,bod.sigla_de_la_empresa,bod.direccion,bod.telefono_1,bod.telefono_2,bod.telefono_3,
    */
    $ps_RADI_NOMB = strip(get_param("s_RADI_NOMB"));
    $ps_solo_nomb = get_param("s_solo_nomb");
    $yaentro = false;
    if (strlen($ps_RADI_NOMB) && $ps_solo_nomb == "All") {
        if ($sWhere != "") {
            $sWhere .= " and (";
        }
        $HasParam = true;
        $sWhere .= "dir.sgd_oem_codigo IN (SELECT sgd_oem_codigo FROM sgd_oem_oempresas d WHERE ";
        $ps_RADI_NOMB = strtoupper($ps_RADI_NOMB);
        $tok = strtok($ps_RADI_NOMB, " ");
        while ($tok) {
            if ($yaentro == true) {
                $sWhere .= " and ";
            }
            $sWhere .= "UPPER(d.sgd_oem_oempresa||d.sgd_oem_rep_legal||d.sgd_oem_nit||d.sgd_oem_sigla||d.sgd_oem_direccion||d.sgd_oem_telefono) LIKE '%" . $tok . "%' ";
            $tok = strtok(" ");
            $yaentro = true;
        }
        $sWhere .= ")";
        $sWhere .= " or (";
        $yaentro = false;
        $tok = strtok($ps_RADI_NOMB, " ");
        while ($tok) {
            if ($yaentro == true) {
                $sWhere .= " and ";
            }
            $sWhere .= "UPPER(r.ra_asun||dir.sgd_dir_nombre) LIKE '%" . $tok . "%' ";
            $tok = strtok(" ");
            $yaentro = true;
        }
        $sWhere .= "))";
    }
    if (strlen($ps_RADI_NOMB) && $ps_solo_nomb == "Any") {
        if ($sWhere != "") {
            $sWhere .= " and (";
        }
        $HasParam = true;
        $sWhere .= "dir.sgd_oem_codigo IN (SELECT sgd_oem_codigo FROM sgd_oem_oempresas d WHERE ";
        $ps_RADI_NOMB = strtoupper($ps_RADI_NOMB);
        $tok = strtok($ps_RADI_NOMB, " ");
        while ($tok) {
            if ($yaentro == true) {
                $sWhere .= " or ";
            }
            $sWhere .= "UPPER(d.sgd_oem_oempresa||d.sgd_oem_rep_legal||d.sgd_oem_nit||d.sgd_oem_sigla||d.sgd_oem_direccion||d.sgd_oem_telefono) LIKE '%" . $tok . "%' ";
            $tok = strtok(" ");
            $yaentro = true;
        }
        $sWhere .= ")";
        $sWhere .= " or (";
        $yaentro = false;
        $tok = strtok($ps_RADI_NOMB, " ");
        while ($tok) {
            if ($yaentro == true) {
                $sWhere .= " or ";
            }
            $sWhere .= "UPPER(r.ra_asun||dir.sgd_dir_nombre) LIKE '%" . $tok . "%' ";
            $tok = strtok(" ");
            $yaentro = true;
        }
        $sWhere .= "))";
    }
    if ($HasParam) {
        $sWhere = " AND (" . $sWhere . ") ";
    }
    //-------------------------------
    // Build base SQL statement
    //-------------------------------
    $sSQL = "SELECT r.radi_nume_radi, r.radi_fech_radi, r.ra_asun,r.radi_pais, r.radi_nume_hoja, \nr.radi_path, r.radi_usu_ante,\ntd.sgd_tpr_descrip, ROUND(((r.radi_fech_radi+(td.sgd_tpr_termino * 7/5))-SYSDATE)) AS diasr, \nu1.usua_login AS login_actu, u1.usua_nomb AS nomb_actu, d1.depe_nomb AS depe_actu,\ndir.sgd_dir_direccion, dir.sgd_dir_telefono, dir.sgd_dir_mail,dir.sgd_dir_nombre,\no.sgd_oem_oempresa,o.sgd_oem_rep_legal,o.sgd_oem_nit, o.sgd_oem_sigla,o.sgd_oem_direccion,o.sgd_oem_telefono\nFROM sgd_dir_drecciones dir, radicado r, sgd_tpr_tpdcumento td, usuario u1, dependencia d1, \nsgd_oem_oempresas o\nWHERE dir.SGD_DIR_TIPO = 1 AND dir.radi_nume_radi=r.radi_nume_radi AND r.tdoc_codi=td.sgd_tpr_codigo\nAND r.radi_usua_actu=u1.usua_codi AND r.radi_depe_actu=u1.depe_codi AND u1.depe_codi=d1.depe_codi\nAND (dir.sgd_oem_codigo=o.sgd_oem_codigo AND NVL(dir.sgd_oem_codigo,0)!=0 AND NVL(dir.sgd_ciu_codigo,0)=0 AND NVL(dir.sgd_esp_codi,0)=0) \n";
    //-------------------------------
    //-------------------------------
    // Assemble full SQL statement
    //-------------------------------
    $sSQL .= $sWhere . $sOrder;
    //-------------------------------
    // Execute SQL statement
    //-------------------------------
    $db->query($sSQL);
    $next_record = $db->next_record();
    //-------------------------------
    // Process empty recordset
    //-------------------------------
    if (!$next_record) {
        ?>
     <tr>
      <td colspan="20" class="DataTD"><font class="DataFONT">No hay resultados</font></td>
     </tr>
<?php 
        //-------------------------------
        //  The insert link.
        //-------------------------------
        ?>
    <tr>
     <td colspan="20" class="ColumnTD"><font class="ColumnFONT">
<?php 
        ?>
  </table>
<?php 
        return;
    }
    //-------------------------------
    ?>
     <!--tr>
      <td colspan="10" class="DataTD"><font class="DataFONT"><b>Total Registros Encontrados: <?php 
    echo $fldTotal;
    ?>
</b></font></td>
     </tr-->

<?php 
    //-------------------------------
    // Initialize page counter and records per page
    //-------------------------------
    $iCounter = 0;
    //-------------------------------
    //-------------------------------
    // Process page scroller
    //-------------------------------
    $iPage = get_param("FormOEMPRESAS_Page");
    if (!strlen($iPage)) {
        $iPage = 1;
    } else {
        if ($iPage == "last") {
            $db_count = get_db_value($sCountSQL);
            $dResult = intval($db_count) / $iRecordsPerPage;
            $iPage = intval($dResult);
            if ($iPage < $dResult) {
                $iPage++;
            }
        } else {
            $iPage = intval($iPage);
        }
    }
    if (($iPage - 1) * $iRecordsPerPage != 0) {
        do {
            $iCounter++;
        } while ($iCounter < ($iPage - 1) * $iRecordsPerPage && $db->next_record());
        $next_record = $db->next_record();
    }
    $iCounter = 0;
    //-------------------------------
    //$ruta_raiz ="..";
    //include "../config.php";
    //include "../jh_class/funciones_sgd.php";
    //-------------------------------
    // Display grid based on recordset
    //-------------------------------.
    while ($next_record && $iCounter < $iRecordsPerPage) {
        //-------------------------------
        // Create field variables based on database fields
        //-------------------------------
        $fldRADI_NUME_RADI = $db->f("RADI_NUME_RADI");
        $fldRADI_FECH_RADI = $db->f("RADI_FECH_RADI");
        $fldASUNTO = $db->f("RA_ASUN");
        $fldTIPO_DOC = $db->f("SGD_TPR_DESCRIP");
        $fldNUME_HOJAS = $db->f("RADI_NUME_HOJA");
        $fldRADI_PATH = $db->f("RADI_PATH");
        $fldDIRECCION_C = $db->f("SGD_DIR_DIRECCION");
        $fldTELEFONO_C = $db->f("SGD_DIR_TELEFONO");
        $fldMAIL_C = $db->f("SGD_DIR_MAIL");
        $fldNOMBRE_EMPRESA = $db->f("SGD_OEM_OEMPRESA");
        $fldREP_LEGAL = $db->f("SGD_OEM_REP_LEGAL");
        $fldNIT_EMPRESA = $db->f("SGD_OEM_NIT");
        $fldSIGLA_EMPRESA = $db->f("SGD_OEM_SIGLA");
        $fldDIRECCION = $db->f("SGD_OEM_DIRECCION");
        $fldTELEFONO = $db->f("SGD_OEM_TELEFONO");
        $fldUSUA_ACTU = $db->f("NOMB_ACTU") . " - (" . $db->f("LOGIN_ACTU") . ")";
        $fldDEPE_ACTU = $db->f("DEPE_ACTU");
        $fldUSUA_ANTE = $db->f("RADI_USU_ANTE");
        //    $fldMUNI_NOMB = $db->f("MUNI_NOMB");
        //    $fldDPTO_NOMB = $db->f("DPTO_NOMB");
        $fldPAIS = $db->f("RADI_PAIS");
        $fldDIASR = $db->f("DIASR");
        $fldFirmante = $db->f("sgd_dir_nombre");
        $next_record = $db->next_record();
        //-------------------------------
        // Show begin
        //-------------------------------
        //-------------------------------
        // Process the HTML controls
        //-------------------------------
        ?>
      <tr>
       <td class="DataTD"><font class="DataFONT">
	  <?php 
        if (strlen($fldRADI_PATH)) {
            $iii = $iii + 1;
            ?>
  <a href='../bodega<?php 
            echo $fldRADI_PATH;
            ?>
' target='Imagen<?php 
            echo $iii;
            ?>
'><?php 
        }
        ?>
	   <font class="DataFONT"><?php 
        echo $fldRADI_NUME_RADI;
        ?>
</font>
	  <?php 
        if (strlen($fldRADI_PATH)) {
            ?>
</a><?php 
        }
        ?>
&nbsp;</font></td>
       <td class="DataTD"><font class="DataFONT"><a href="../verradicado.php?verrad=<?php 
        echo $fldRADI_NUME_RADI . "&" . session_name() . "=" . session_id() . "&krd={$krd}&carpeta=8&nomcarpeta=Busquedas&tipo_carp=0";
        ?>
">
      <?php 
        echo tohtml($fldRADI_FECH_RADI);
        ?>
&nbsp;</a></font></td>
	   <td class="DataTD"><font class="DataFONT">
      <?php 
        echo tohtml($fldASUNTO);
        ?>
&nbsp;</font></td>
       <td class="DataTD"><font class="DataFONT">
      <?php 
        echo tohtml($fldTIPO_DOC);
        ?>
&nbsp;</font></td>
       <td class="DataTD"><font class="DataFONT">
      <?php 
        echo tohtml($fldNUME_HOJAS);
        ?>
&nbsp;</font></td>
       <td class="DataTD"><font class="DataFONT">
      <?php 
        echo tohtml($fldDIRECCION_C);
        ?>
&nbsp;</font></td>
       <td class="DataTD"><font class="DataFONT">
      <?php 
        echo tohtml($fldTELEFONO_C);
        ?>
&nbsp;</font></td>
	   <td class="DataTD"><font class="DataFONT">
      <?php 
        echo tohtml($fldMAIL_C);
        ?>
&nbsp;</font></td>
	   <td class="DataTD"><font class="DataFONT">
      <?php 
        echo tohtml($fldNOMBRE_EMPRESA);
        ?>
&nbsp;</font></td>
	   <td class="DataTD"><font class="DataFONT">
      <?php 
        echo tohtml($fldREP_LEGAL);
        ?>
&nbsp;</font></td>
	   <td class="DataTD"><font class="DataFONT">
      <?php 
        echo tohtml($fldNIT_EMPRESA);
        ?>
&nbsp;</font></td>
	   <td class="DataTD"><font class="DataFONT">
      <?php 
        echo tohtml($fldSIGLA_EMPRESA);
        ?>
&nbsp;</font></td>
	   <td class="DataTD"><font class="DataFONT">
      <?php 
        echo tohtml($fldDIRECCION);
        ?>
&nbsp;</font></td>
	   <td class="DataTD"><font class="DataFONT">
      <?php 
        echo tohtml($fldTELEFONO);
        ?>
&nbsp;</font></td>
	   <td class="DataTD"><font class="DataFONT">
      <?php 
        echo tohtml($fldUSUA_ACTU);
        ?>
&nbsp;</font></td>
	   <td class="DataTD"><font class="DataFONT">
      <?php 
        echo tohtml($fldDEPE_ACTU);
        ?>
&nbsp;</font></td>
	   <td class="DataTD"><font class="DataFONT">
      <?php 
        echo tohtml($fldUSUA_ANTE);
        ?>
&nbsp;</font></td>
	   <td class="DataTD"><font class="DataFONT">
      <?php 
        echo tohtml($fldFirmante);
        ?>
&nbsp;</font></td>
       <!--td class="DataTD"><font class="DataFONT">
      <?php 
        echo tohtml($fldMUNI_NOMB);
        ?>
&nbsp;</font></td>	  
       <td class="DataTD"><font class="DataFONT">
      <?php 
        echo tohtml($fldDPTO_NOMB);
        ?>
&nbsp;</font></td--> 
       <td class="DataTD"><font class="DataFONT">
      <?php 
        echo tohtml($fldPAIS);
        ?>
&nbsp;</font></td>	  
      <td class="DataTD"><font class="DataFONT">
      <?php 
        if ($fldRADI_DEPE_ACTU != 999) {
            echo tohtml($fldDIASR);
        } else {
            echo "Sal";
        }
        ?>
&nbsp;</font></td>	  
     </tr>
	  <?php 
        $iCounter++;
    }
    //-------------------------------
    //  Record navigator.
    //-------------------------------
    ?>
    <tr>
     <td colspan="20" class="ColumnTD"><font class="ColumnFONT">
<?php 
    // Navigation begin
    $bEof = $next_record;
    if ($bEof || $iPage != 1) {
        $iCounter = 1;
        $iHasPages = $iPage;
        $sPages = "";
        $iDisplayPages = 0;
        $iNumberOfPages = 30;
        /* El número de páginas que aparecerán en el navegador al pie de la página */
        while ($next_record && $iHasPages < $iPage + $iNumberOfPages) {
            if ($iCounter == $iRecordsPerPage) {
                $iCounter = 0;
                $iHasPages = $iHasPages + 1;
            }
            $iCounter++;
            $next_record = $db->next_record();
        }
        if (!$next_record && $iCounter > 1) {
            $iHasPages++;
        }
        if ($iHasPages - $iPage < intval($iNumberOfPages / 2)) {
            $iStartPage = $iHasPages - $iNumberOfPages;
        } else {
            $iStartPage = $iPage - $iNumberOfPages + intval($iNumberOfPages / 2);
        }
        if ($iStartPage < 0) {
            $iStartPage = 0;
        }
        for ($iPageCount = $iPageCount + 1; $iPageCount <= $iPage - 1; $iPageCount++) {
            $sPages .= "<a href=" . $sFileName . "?" . $form_params . $sSortParams . "FormOEMPRESAS_Page=" . $iPageCount . "#RADICADO\"><font " . "class=\"ColumnFONT\"" . ">" . $iPageCount . "</font></a>&nbsp;";
            $iDisplayPages++;
        }
        $sPages .= "<font " . "class=\"ColumnFONT\"" . "><b>" . $iPage . "</b></font>&nbsp;";
        $iDisplayPages++;
        $iPageCount = $iPage + 1;
        while ($iDisplayPages < $iNumberOfPages && $iStartPage + $iDisplayPages < $iHasPages) {
            $sPages .= "<a href=\"" . $sFileName . "?" . $form_params . $sSortParams . "FormOEMPRESAS_Page=" . $iPageCount . "#RADICADO\"><font " . "class=\"ColumnFONT\"" . ">" . $iPageCount . "</font></a>&nbsp;";
            $iDisplayPages++;
            $iPageCount++;
        }
        if ($iPage == 1) {
            ?>
        <font class="ColumnFONT">Primero</font>
        <font class="ColumnFONT">Anterior</font>
<?php 
        } else {
            ?>
        <a href="<?php 
            echo $sFileName;
            ?>
?<?php 
            echo $form_params;
            echo $sSortParams;
            ?>
FormOEMPRESAS_Page=1#RADICADO"><font class="ColumnFONT">Primero</font></a>
        <a href="<?php 
            echo $sFileName;
            ?>
?<?php 
            echo $form_params;
            echo $sSortParams;
            ?>
FormOEMPRESAS_Page=<?php 
            echo $iPage - 1;
            ?>
#RADICADO"><font class="ColumnFONT">Anterior</font></a>
<?php 
        }
        echo "&nbsp;[&nbsp;" . $sPages . "]&nbsp;";
        if (!$bEof) {
            ?>
        <font class="ColumnFONT">Siguiente</font>
        <font class="ColumnFONT">Ultimo</font>
<?php 
        } else {
            ?>
        <a href="<?php 
            echo $sFileName;
            ?>
?<?php 
            echo $form_params;
            echo $sSortParams;
            ?>
FormOEMPRESAS_Page=<?php 
            echo $iPage + 1;
            ?>
#RADICADO"><font class="ColumnFONT">Siguiente</font></a>
        <a href="<?php 
            echo $sFileName;
            ?>
?<?php 
            echo $form_params;
            echo $sSortParams;
            ?>
FormOEMPRESAS_Page=last#RADICADO"><font class="ColumnFONT">Ultimo</font></a>
<?php 
        }
    }
    //-------------------------------
    // Navigation end
    //-------------------------------
    ?>
      </font></td></tr>
    </table>
  <?php 
}
        $ethnicity_id = get_param("id");
        if ($norem = $db->get_results("SELECT studentbio_ethnicity FROM studentbio WHERE studentbio_ethnicity='" . $ethnicity_id . "'")) {
            $msgFormErr = _ADMIN_ETHNICITY_FORM_ERROR;
        } else {
            $sSQL = "DELETE FROM ethnicity WHERE ethnicity_id='" . $ethnicity_id . "'";
            $db->query($sSQL);
        }
        break;
    case "add":
        //Check for duplicates
        $ethnicity_desc = get_param("ethnicityname");
        $tot = $db->get_var("SELECT count(*) FROM ethnicity WHERE ethnicity_desc='{$ethnicity_desc}'");
        if ($tot > 0) {
            $msgFormErr = _ADMIN_ETHNICITY_DUP;
        } else {
            $sSQL = "INSERT INTO ethnicity (ethnicity_desc) VALUES (" . tosql($ethnicity_desc, "Text") . ")";
            $db->query($sSQL);
        }
        break;
    case "edit":
        $ethnicity_id = get_param("id");
        $sSQL = "SELECT ethnicity_desc FROM ethnicity WHERE ethnicity_id='" . $ethnicity_id . "'";
        $ethnicity_desc = $db->get_var($sSQL);
        break;
    case "update":
        $ethnicity_id = get_param("id");
        $ethnicity_desc = get_param("ethnicityname");
        $sSQL = "UPDATE ethnicity SET ethnicity_desc='{$ethnicity_desc}' WHERE ethnicity_id='" . $ethnicity_id . "'";
        $db->query($sSQL);
        break;
}
Пример #18
0
function HIST_EVENTOS_show()
{
    //-------------------------------
    // Initialize variables
    //-------------------------------
    global $db;
    global $sHIST_EVENTOSErr;
    global $sFileName;
    global $styles;
    $sWhere = "";
    $sOrder = "";
    $sSQL = "";
    $sFormTitle = "Historico";
    $HasParam = false;
    $bReq = true;
    $iRecordsPerPage = 20;
    $iCounter = 0;
    $iPage = 0;
    $bEof = false;
    $iSort = "";
    $iSorted = "";
    $sDirection = "";
    $sSortParams = "";
    $transit_params = "";
    $form_params = "radicado=" . tourl(get_param("radicado")) . "&";
    //-------------------------------
    // Build ORDER BY statement
    //-------------------------------
    $sOrder = " order by H.HIST_FECH Asc";
    $iSort = get_param("FormHIST_EVENTOS_Sorting");
    $iSorted = get_param("FormHIST_EVENTOS_Sorted");
    if (!$iSort) {
        $form_sorting = "";
    } else {
        if ($iSort == $iSorted) {
            $form_sorting = "";
            $sDirection = " DESC";
            $sSortParams = "FormHIST_EVENTOS_Sorting=" . $iSort . "&FormHIST_EVENTOS_Sorted=" . $iSort . "&";
        } else {
            $form_sorting = $iSort;
            $sDirection = " ASC";
            $sSortParams = "FormHIST_EVENTOS_Sorting=" . $iSort . "&FormHIST_EVENTOS_Sorted=" . "&";
        }
        if ($iSort == 1) {
            $sOrder = " order by H.RADI_NUME_RADI" . $sDirection;
        }
        if ($iSort == 2) {
            $sOrder = " order by H.HIST_FECH" . $sDirection;
        }
        if ($iSort == 3) {
            $sOrder = " order by U.USUA_NOMB" . $sDirection;
        }
        if ($iSort == 4) {
            $sOrder = " order by D.DEPE_NOMB" . $sDirection;
        }
        if ($iSort == 5) {
            $sOrder = " order by H.HIST_OBSE" . $sDirection;
        }
    }
    //-------------------------------
    // HTML column headers
    //-------------------------------
    ?>

     <table class="FormTABLE">
      <tr>
       <td class="FormHeaderTD" colspan="5"><a name="HIST_EVENTOS"><font class="FormHeaderFONT"><?php 
    echo $sFormTitle;
    ?>
</font></a></td>
	 </tr>
<?php 
    $pradicado = get_param("radicado");
    $queryUsuActu = "select U.USUA_LOGIN AS U_USUA_LOGIN, U.USUA_NOMB AS U_USUA_NOMB from RADICADO R, USUARIO U, DEPENDENCIA D" . " WHERE U.USUA_CODI=R.RADI_USUA_ACTU and D.DEPE_CODI=R.RADI_DEPE_ACTU and U.DEPE_CODI=D.DEPE_CODI and R.RADI_NUME_RADI= {$pradicado}";
    $db->query($queryUsuActu);
    $next_record = $db->next_record();
    if ($next_record) {
        $fldUSUA_LOGIN = $db->f("U_USUA_LOGIN");
        $fldUSUA_NOMB = $db->f("U_USUA_NOMB");
        ?>
	  
	 <tr>
	   <td class="ColumnTD" colspan="5">
	   <font class="ColumnFONT">El usuario Actual es <?php 
        echo $fldUSUA_LOGIN;
        ?>
 / <?php 
        echo $fldUSUA_NOMB;
        ?>
	   </font></td>
      </tr>
<?php 
    }
    ?>
	  <tr>
       <td class="ColumnTD"><a href="<?php 
    echo $sFileName;
    ?>
?<?php 
    echo $form_params;
    ?>
FormHIST_EVENTOS_Sorting=1&FormHIST_EVENTOS_Sorted=<?php 
    echo $form_sorting;
    ?>
&"><font class="ColumnFONT">Radicado</font></a></td>
       <td class="ColumnTD"><a href="<?php 
    echo $sFileName;
    ?>
?<?php 
    echo $form_params;
    ?>
FormHIST_EVENTOS_Sorting=2&FormHIST_EVENTOS_Sorted=<?php 
    echo $form_sorting;
    ?>
&"><font class="ColumnFONT">Fecha</font></a></td>
       <td class="ColumnTD"><a href="<?php 
    echo $sFileName;
    ?>
?<?php 
    echo $form_params;
    ?>
FormHIST_EVENTOS_Sorting=3&FormHIST_EVENTOS_Sorted=<?php 
    echo $form_sorting;
    ?>
&"><font class="ColumnFONT">Codigo Usuario</font></a></td>
       <td class="ColumnTD"><a href="<?php 
    echo $sFileName;
    ?>
?<?php 
    echo $form_params;
    ?>
FormHIST_EVENTOS_Sorting=4&FormHIST_EVENTOS_Sorted=<?php 
    echo $form_sorting;
    ?>
&"><font class="ColumnFONT">Dependencia</font></a></td>
       <td class="ColumnTD"><a href="<?php 
    echo $sFileName;
    ?>
?<?php 
    echo $form_params;
    ?>
FormHIST_EVENTOS_Sorting=5&FormHIST_EVENTOS_Sorted=<?php 
    echo $form_sorting;
    ?>
&"><font class="ColumnFONT">Observaciones</font></a></td>
      </tr>
<?php 
    //-------------------------------
    // Build WHERE statement
    //-------------------------------
    $pradicado = get_param("radicado");
    if (strlen($pradicado)) {
        $HasParam = true;
        $sWhere = $sWhere . "H.RADI_NUME_RADI=" . tosql($pradicado, "Text") . "";
    } else {
        $bReq = false;
    }
    if ($HasParam) {
        $sWhere = " AND (" . $sWhere . ")";
    }
    //-------------------------------
    // Build base SQL statement
    //-------------------------------
    $sSQL = "select H.DEPE_CODI as H_DEPE_CODI, " . "to_char(H.HIST_FECH,'dd/mm/yyyy hh24:mi:ss') as H_HIST_FECH, " . "H.HIST_OBSE as H_HIST_OBSE, " . "H.RADI_NUME_RADI as H_RADI_NUME_RADI, " . "H.USUA_CODI as H_USUA_CODI, " . "U.USUA_CODI as U_USUA_CODI, " . "U.USUA_NOMB as U_USUA_NOMB, " . "U.DEPE_CODI as U_DEPE_CODI, " . "D.DEPE_CODI as D_DEPE_CODI, " . "D.DEPE_NOMB as D_DEPE_NOMB " . " from HIST_EVENTOS H, USUARIO U, DEPENDENCIA D" . " where U.USUA_CODI=H.USUA_CODI and D.DEPE_CODI=H.DEPE_CODI and U.DEPE_CODI=D.DEPE_CODI  ";
    //-------------------------------
    //-------------------------------
    // HIST_EVENTOS Open Event begin
    // HIST_EVENTOS Open Event end
    //-------------------------------
    //-------------------------------
    // Assemble full SQL statement
    //-------------------------------
    $sSQL .= $sWhere . $sOrder;
    //-------------------------------
    //-------------------------------
    // Process if form has all required parameters
    //-------------------------------
    if (!$bReq) {
        ?>
     <tr>
      <td colspan="5" class="DataTD"><font class="DataFONT">No hay Registros</font></td>
     </tr>
    </table>
<?php 
        return;
    }
    //-------------------------------
    //-------------------------------
    // Execute SQL statement
    //-------------------------------
    $db->query($sSQL);
    $next_record = $db->next_record();
    //-------------------------------
    // Process empty recordset
    //-------------------------------
    if (!$next_record) {
        ?>
     <tr>
      <td colspan="5" class="DataTD"><font class="DataFONT">No hay Registros</font></td>
     </tr>
<?php 
        //-------------------------------
        //  The insert link.
        //-------------------------------
        ?>
    <tr>
     <td colspan="5" class="ColumnTD"><font class="ColumnFONT">
<?php 
        ?>
  </table>
<?php 
        return;
    }
    //-------------------------------
    //-------------------------------
    // Initialize page counter and records per page
    //-------------------------------
    $iRecordsPerPage = 20;
    $iCounter = 0;
    //-------------------------------
    //-------------------------------
    // Process page scroller
    //-------------------------------
    $iPage = get_param("FormHIST_EVENTOS_Page");
    if (!strlen($iPage)) {
        $iPage = 1;
    } else {
        $iPage = intval($iPage);
    }
    if (($iPage - 1) * $iRecordsPerPage != 0) {
        do {
            $iCounter++;
        } while ($iCounter < ($iPage - 1) * $iRecordsPerPage && $db->next_record());
        $next_record = $db->next_record();
    }
    $iCounter = 0;
    //-------------------------------
    //-------------------------------
    // Display grid based on recordset
    //-------------------------------
    while ($next_record && $iCounter < $iRecordsPerPage) {
        //-------------------------------
        // Create field variables based on database fields
        //-------------------------------
        $fldDEPE_CODI = $db->f("D_DEPE_NOMB");
        $fldHIST_FECH = $db->f("H_HIST_FECH");
        $fldHIST_OBSE = $db->f("H_HIST_OBSE");
        $fldRADI_NUME_RADI = $db->f("H_RADI_NUME_RADI");
        $fldUSUA_CODI = $db->f("U_USUA_NOMB");
        $next_record = $db->next_record();
        //-------------------------------
        // HIST_EVENTOS Show begin
        //-------------------------------
        //-------------------------------
        // HIST_EVENTOS Show Event begin
        // HIST_EVENTOS Show Event end
        //-------------------------------
        //-------------------------------
        // Process the HTML controls
        //-------------------------------
        ?>
      <tr>
       <td class="DataTD"><font class="DataFONT">
      <?php 
        echo tohtml($fldRADI_NUME_RADI);
        ?>
&nbsp;</font></td>
       <td class="DataTD"><font class="DataFONT">
      <?php 
        echo $fldHIST_FECH;
        ?>
&nbsp;</font></td>
       <td class="DataTD"><font class="DataFONT">
      <?php 
        echo tohtml($fldUSUA_CODI);
        ?>
&nbsp;</font></td>
       <td class="DataTD"><font class="DataFONT">
      <?php 
        echo tohtml($fldDEPE_CODI);
        ?>
&nbsp;</font></td>
       <td class="DataTD"><font class="DataFONT">
      <?php 
        echo tohtml($fldHIST_OBSE);
        ?>
&nbsp;</font></td>
      </tr><?php 
        //-------------------------------
        // HIST_EVENTOS Show end
        //-------------------------------
        //-------------------------------
        // Move to the next record and increase record counter
        //-------------------------------
        $iCounter++;
    }
    //-------------------------------
    //  Grid. The insert link and record navigator.
    //-------------------------------
    ?>
    <tr>
     <td colspan="5" class="ColumnTD"><font class="ColumnFONT">
<?php 
    // HIST_EVENTOS Navigation begin
    $bEof = $next_record;
    if ($bEof || $iPage != 1) {
        if ($iPage == 1) {
            ?>
        <font class="ColumnFONT">Anterior</font>
<?php 
        } else {
            ?>
        <a href="<?php 
            echo $sFileName;
            ?>
?<?php 
            echo $form_params;
            echo $sSortParams;
            ?>
FormHIST_EVENTOS_Page=<?php 
            echo $iPage - 1;
            ?>
#HIST_EVENTOS"><font class="ColumnFONT">Anterior</font></a>
<?php 
        }
        echo "&nbsp;[&nbsp;" . $iPage . "&nbsp;]&nbsp;";
        if (!$bEof) {
            ?>
        <font class="ColumnFONT">Siguiente</font>
<?php 
        } else {
            ?>
        <a href="<?php 
            echo $sFileName;
            ?>
?<?php 
            echo $form_params;
            echo $sSortParams;
            ?>
FormHIST_EVENTOS_Page=<?php 
            echo $iPage + 1;
            ?>
#HIST_EVENTOS"><font class="ColumnFONT">Siguiente</font></a>
<?php 
        }
    }
    //-------------------------------
    // HIST_EVENTOS Navigation end
    //-------------------------------
    //-------------------------------
    // Finish form processing
    //-------------------------------
    ?>
      </font></td></tr>
    </table>
  <?php 
    //-------------------------------
    // HIST_EVENTOS Close Event begin
    // HIST_EVENTOS Close Event end
    //-------------------------------
}
Пример #19
0
function buscar_prueba($nivelus, $tpRemDes, $whereFlds)
{
    global $ruta_raiz;
    $db = new ConnectionHandler($ruta_raiz);
    //$db->conn->debug=true;
    //constrimos las  condiciones dependiendo de los parametros de busqueda seleccionados
    $ps_desde_RADI_FECH_RADI = mktime(0, 0, 0, get_param("s_desde_mes"), get_param("s_desde_dia"), get_param("s_desde_ano"));
    $ps_hasta_RADI_FECH_RADI = mktime(23, 59, 59, get_param("s_hasta_mes"), get_param("s_hasta_dia"), get_param("s_hasta_ano"));
    $where = " AND (R.RADI_FECH_RADI BETWEEN " . $db->conn->DBDate($ps_desde_RADI_FECH_RADI) . " AND " . $db->conn->DBDate($ps_hasta_RADI_FECH_RADI) . ")";
    // se rescantan los parametros de busqueda
    $ps_RADI_NUME_RADI = trim(get_param("s_RADI_NUME_RADI"));
    $ps_DOCTO = trim(get_param("s_DOCTO"));
    $ps_RADI_DEPE_ACTU = get_param("s_RADI_DEPE_ACTU");
    $ps_SGD_EXP_SUBEXPEDIENTE = trim(get_param("s_SGD_EXP_SUBEXPEDIENTE"));
    $ps_solo_nomb = get_param("s_solo_nomb");
    $ps_RADI_NOMB = trim(strip(get_param("s_RADI_NOMB")));
    $ps_entrada = strip(get_param("s_entrada"));
    $ps_TDOC_CODI = get_param("s_TDOC_CODI");
    $ps_METADATO = trim(strip(get_param("s_METADATO")));
    //parametro de metadato
    $ps_salida = strip(get_param("s_salida"));
    $sFormTitle = "Radicados encontrados {$tpRemDesNombre}";
    $ps_RADI_DEPE_ACTU = is_number($ps_RADI_DEPE_ACTU) && strlen($ps_RADI_DEPE_ACTU) ? tosql($ps_RADI_DEPE_ACTU, "Number") : "";
    $where = strlen($ps_RADI_DEPE_ACTU) > 0 ? $where . " AND R.RADI_DEPE_ACTU = " . $ps_RADI_DEPE_ACTU : $where;
    $where = strlen($ps_RADI_NUME_RADI) ? $where . " AND R.RADI_NUME_RADI  LIKE " . tosql("%" . trim($ps_RADI_NUME_RADI) . "%", "Text") : $where;
    switch ($tpRemDes) {
        case 1:
            $tpRemDesNombre = "Por Ciudadano";
            $where .= " and dir.sgd_trd_codigo = {$whereFlds}  ";
            break;
        case 2:
            $tpRemDesNombre = "Por Otras Empresas";
            $where .= " and dir.sgd_trd_codigo = {$whereFlds}  ";
            break;
        case 3:
            $tpRemDesNombre = "Por Entidad";
            $where .= " and dir.sgd_trd_codigo = {$whereFlds}  ";
            break;
        case 4:
            $tpRemDesNombre = "Por Funcionario";
            $where .= " and dir.sgd_trd_codigo = {$whereFlds}  ";
            break;
        case 9:
            $tpRemDesNombre = "";
    }
    $where = strlen($ps_DOCTO) ? " AND  DIR.SGD_DIR_DOC = '{$ps_DOCTO}' " : $where;
    if (strlen($ps_SGD_EXP_SUBEXPEDIENTE) != 0) {
        $min = "INNER JOIN SGD_EXP_EXPEDIENTE MINEXP ON R.RADI_NUME_RADI=MINEXP.RADI_NUME_RADI";
        $where = $where . " AND MINEXP.SGD_EXP_ESTADO <> 2";
        $where = $where . " AND (\n        \t    SEXP.SGD_EXP_NUMERO LIKE '%" . str_replace('\'', '', tosql($ps_SGD_EXP_SUBEXPEDIENTE, "Text")) . "%' \n        \t\tOR SEXP.SGD_SEXP_PAREXP1 LIKE UPPER( '%" . str_replace('\'', '', tosql($ps_SGD_EXP_SUBEXPEDIENTE, "Text")) . "%') \n        \t\tOR SEXP.SGD_SEXP_PAREXP2 LIKE UPPER( '%" . str_replace('\'', '', tosql($ps_SGD_EXP_SUBEXPEDIENTE, "Text")) . "%') \n        \t\tOR SEXP.SGD_SEXP_PAREXP3 LIKE UPPER( '%" . str_replace('\'', '', tosql($ps_SGD_EXP_SUBEXPEDIENTE, "Text")) . "%')\n        \t\tOR SEXP.SGD_SEXP_PAREXP4 LIKE UPPER( '%" . str_replace('\'', '', tosql($ps_SGD_EXP_SUBEXPEDIENTE, "Text")) . "%')\n        \t\tOR SEXP.SGD_SEXP_PAREXP5 LIKE UPPER( '%" . str_replace('\'', '', tosql($ps_SGD_EXP_SUBEXPEDIENTE, "Text")) . "%'))";
    } else {
        $min = "LEFT JOIN\n    \t(SELECT RADI_NUME_RADI,MIN(SGD_EXP_FECH) FECHA FROM SGD_EXP_EXPEDIENTE GROUP BY SGD_EXP_NUMERO, RADI_NUME_RADI)\n    \t MINE ON MINE.RADI_NUME_RADI=R.RADI_NUME_RADI LEFT JOIN SGD_EXP_EXPEDIENTE MINEXP ON (MINE.RADI_NUME_RADI=MINEXP.RADI_NUME_RADI AND MINE.FECHA=MINEXP.SGD_EXP_FECH)";
    }
    $where = $ps_entrada != "9999" ? $where . " AND R.RADI_NUME_RADI like " . tosql("%" . trim($ps_entrada), "Text") . ")" : $where;
    /* Se decide si busca en radicado de entrada o de salida o ambos */
    $eLen = strlen($ps_entrada);
    $sLen = strlen($ps_salida);
    $where = is_number($ps_TDOC_CODI) && strlen($ps_TDOC_CODI) && $ps_TDOC_CODI != "9999" ? $where . " AND R.TDOC_CODI=" . tosql($ps_TDOC_CODI, "Number") : $where;
    /* Se recibe la caadena a buscar y el tipo de busqueda (All) (Any) */
    if (strlen($ps_RADI_NOMB)) {
        //&& $ps_solo_nomb == "Any")
        $ps_RADI_NOMB = strtoupper($ps_RADI_NOMB);
        $concatenacion = "UPPER(" . $db->conn->Concat("R.RA_ASUN", "R.RADI_CUENTAI", "DIR.SGD_DIR_TELEFONO", "DIR.SGD_DIR_DIRECCION") . ") LIKE '%";
        $tok = explode(" ", $ps_RADI_NOMB);
        $where .= " AND ((UPPER(dir.sgd_dir_nomremdes) LIKE '%" . implode("%' AND UPPER(dir.sgd_dir_nomremdes) LIKE '%", $tok) . "%') ";
        $where .= "OR ( UPPER(dir.sgd_dir_nombre) LIKE '%" . implode("%' AND UPPER(dir.sgd_dir_nombre) LIKE '%", $tok) . "%')";
        $where .= " OR (" . $concatenacion . implode("%' AND " . $concatenacion, $tok) . "%'))";
    }
    //-------------------------------
    // Build base SQL statement
    //-------------------------------
    include "{$ruta_raiz}/include/query/busqueda/busquedaPiloto1.php";
    require_once "{$ruta_raiz}/include/myPaginador.inc.php";
    $titulos = array("#", "1#RADICADO", "3#FECHA RADICACION", "2#EXPEDIENTE", "4#ASUNTO", "14#TIPO DE DIOCUMENTO", "21#TIPO", "7#NO DE HOJAS", "15#DIRECCION CONTACTO", "18#TELEFONO CONTACTO", "16#MAIL CONTACTO ", "20#DIGNATARIO", "17#NOMBRE", "19#DOCUMENTO", "22#USUARIO ACTUAL", "10#DEPENDENCIA ACTUAL", "23#USUARIO ANTERIOR", "11#PAIS", "13#DIAS RESTANTES");
    $sSQL = "select\n\t        R.RADI_NUME_RADI,MINEXP.SGD_EXP_NUMERO," . $db->conn->SQLDate('Y-m-d H:i:s', 'R.RADI_FECH_RADI') . " AS RADI_FECH_RADI,\n\t        R.RA_ASUN,\n\t        R.RADI_NUME_HOJA,R.RADI_PATH,R.RADI_USUA_ACTU,R.CODI_NIVEL, \n\t        R.SGD_SPUB_CODIGO,R.RADI_DEPE_ACTU,R.RADI_PAIS,D.DEPE_NOMB,\n                                            {$redondeo} AS DIASR,TD.SGD_TPR_DESCRIP,DIR.SGD_DIR_DIRECCION, DIR.SGD_DIR_MAIL,\n\t        DIR.SGD_DIR_NOMREMDES,DIR.SGD_DIR_TELEFONO,DIR.SGD_DIR_DOC,DIR.SGD_DIR_NOMBRE,\n\t        DIR.SGD_TRD_CODIGO, U.USUA_NOMB USUARIO_ACTUAL, AL.USUA_NOMB USUARIO_ANTERIOR,\n\t        U.CODI_NIVEL USUA_NIVEL,SGD_EXP_PRIVADO\n        FROM RADICADO R INNER JOIN SGD_DIR_DRECCIONES DIR ON R.RADI_NUME_RADI=DIR.RADI_NUME_RADI \n\t        INNER JOIN SGD_TPR_TPDCUMENTO TD ON R.TDOC_CODI=TD.SGD_TPR_CODIGO \n\t        INNER JOIN USUARIO U ON R.RADI_USUA_ACTU=U.USUA_CODI AND R.RADI_DEPE_ACTU=U.DEPE_CODI \n\t        LEFT JOIN USUARIO AL ON R.RADI_USU_ANTE=AL.USUA_LOGIN \n\t        LEFT JOIN DEPENDENCIA D ON D.DEPE_CODI=R.RADI_DEPE_ACTU \n                                            {$min}\n\t        LEFT JOIN SGD_SEXP_SECEXPEDIENTES SEXP ON MINEXP.SGD_EXP_NUMERO=SEXP.SGD_EXP_NUMERO\n                                    \n\t    WHERE DIR.SGD_DIR_TIPO = 1 \n                                            " . $where;
    echo "<table >\n\t\t\t<tr>\n\t\t\t<td class=\"titulos4\" colspan=\"20\" width=\"2000\" ><a name=\"RADICADO\">{$sFormTitle}</a></td>\n\t\t\t</tr>\n\t\t </table>";
    //$db->conn->debug=true;
    $paginador = new myPaginador($db, strtoupper($sSQL), null, "", 25);
    $paginador->setImagenASC($ruta_raiz . "iconos/flechaasc.gif");
    $paginador->setImagenDESC($ruta_raiz . "iconos/flechadesc.gif");
    $paginador->setFuncionFilas("pintarResultadoConsultas");
    $paginador->setpropiedadesTabla(array('width' => "2000", 'border' => '0', 'cellpadding' => '5', 'cellspacing' => '5', 'class' => 'borde_tab'));
    $paginador->setPie($pie);
    echo $paginador->generarPagina($titulos, "titulos3");
}
    $action = "none";
}
//Add or Remove subjects according to admin choice
switch ($action) {
    case "remove":
        $subject_id = get_param("id");
        if ($norem = $db->get_results("SELECT \ngrade_history_subject FROM \ngrade_history WHERE grade_history_subject={$subject_id}")) {
            $msgFormErr = _ADMIN_SUBJECTS_FORM_ERROR;
        } else {
            $sSQL = "DELETE FROM grade_subjects WHERE \ngrade_subject_id={$subject_id}";
            $db->query($sSQL);
        }
        break;
    case "add":
        //Check for duplicates
        $subject_desc = tosql(get_param("subjectname"), "Text");
        $sSQL = "SELECT COUNT(*) FROM grade_subjects WHERE \ngrade_subject_desc={$subject_desc}";
        $tot = $db->get_var($sSQL);
        if ($tot > 0) {
            $msgFormErr = _ADMIN_SUBJECTS_DUP;
        } else {
            $sSQL = "INSERT INTO grade_subjects (grade_subject_desc) \nVALUES (" . $subject_desc . ")";
            $db->query($sSQL);
        }
        break;
    case "edit":
        $subject_id = get_param("id");
        $sSQL = "SELECT grade_subject_desc FROM grade_subjects \nWHERE grade_subject_id={$subject_id}";
        $subject_desc = $db->get_var($sSQL);
        break;
    case "update":
Пример #21
0
function detalle_show()
{
    //-------------------------------
    // Initialize variables
    //-------------------------------
    global $db;
    global $sdetalleErr;
    global $sFileName;
    global $styles;
    $sWhere = "";
    $sOrder = "";
    $sSQL = "";
    $sFormTitle = "Detalle Radicado";
    $HasParam = false;
    $bReq = true;
    $iRecordsPerPage = 5;
    $iCounter = 0;
    $iSort = "";
    $iSorted = "";
    $sDirection = "";
    $sSortParams = "";
    $transit_params = "";
    //-------------------------------
    // Build ORDER BY statement
    //-------------------------------
    $iSort = get_param("Formdetalle_Sorting");
    $iSorted = get_param("Formdetalle_Sorted");
    //-------------------------------
    // HTML column headers
    //-------------------------------
    ?>
  <table class="FormTABLE">
      <tr>
       <td class="FormHeaderTD" colspan="2"><a name="detalle"><font class="FormHeaderFONT"><?php 
    echo $sFormTitle;
    ?>
</font></a></td>
      </tr>
<?php 
    //-------------------------------
    // Build WHERE statement
    //-------------------------------
    $ps_RADI_NUME_RADI = get_param("s_RADI_NUME_RADI");
    if (strlen($ps_RADI_NUME_RADI)) {
        $HasParam = true;
        $sWhere = $sWhere . "R.RADI_NUME_RADI=" . tosql($ps_RADI_NUME_RADI, "Text") . "";
    } else {
        $bReq = false;
    }
    if ($HasParam) {
        $sWhere = " AND (" . $sWhere . ")";
    }
    //-------------------------------
    // Build base SQL statement
    //-------------------------------
    $sSQL = "select R.CARP_CODI as R_CARP_CODI, " . "R.CPOB_CODI as R_CPOB_CODI, " . "R.DPTO_CODI as R_DPTO_CODI, " . "R.EESP_CODI as R_EESP_CODI, " . "R.ESTA_CODI as R_ESTA_CODI, " . "R.MREC_CODI as R_MREC_CODI, " . "R.MUNI_CODI as R_MUNI_CODI, " . "R.RADI_DEPE_ACTU as R_RADI_DEPE_ACTU, " . "R.RADI_DEPE_RADI as R_RADI_DEPE_RADI, " . "R.RADI_DESC_ANEX as R_RADI_DESC_ANEX, " . "R.RADI_DIRE_CORR as R_RADI_DIRE_CORR, " . "R.RADI_FECH_ASIG as R_RADI_FECH_ASIG, " . "to_char(R.RADI_FECH_RADI,'dd/mm/yyyy hh24:mi:ss') as R_RADI_FECH_RADI, " . "R.RADI_NOMB as R_RADI_NOMB, " . "R.RADI_NUME_DERI as R_RADI_NUME_DERI, " . "R.RADI_NUME_HOJA as R_RADI_NUME_HOJA, " . "R.RADI_NUME_IDEN as R_RADI_NUME_IDEN, " . "R.RADI_NUME_RADI as R_RADI_NUME_RADI, " . "R.RADI_PAIS as R_RADI_PAIS, " . "R.RADI_PATH as R_RADI_PATH, " . "R.RADI_PRIM_APEL as R_RADI_PRIM_APEL, " . "R.RADI_REM as R_RADI_REM, " . "R.RADI_SEGU_APEL as R_RADI_SEGU_APEL, " . "R.RADI_TELE_CONT as R_RADI_TELE_CONT, " . "R.RADI_TIPO_EMPR as R_RADI_TIPO_EMPR, " . "R.RADI_USUA_ACTU as R_RADI_USUA_ACTU, " . "R.RADI_USUA_RADI as R_RADI_USUA_RADI, " . "R.RADI_USU_ANTE as R_RADI_USU_ANTE, " . "R.RA_ASUN as R_RA_ASUN, " . "R.TDID_CODI as R_TDID_CODI, " . "R.TDOC_CODI as R_TDOC_CODI, " . "R.TRTE_CODI as R_TRTE_CODI, " . "R.CODI_NIVEL as R_CODI_NIVEL, " . "T.SGD_TPR_CODIGO as T_TDOC_CODI, " . "T.SGD_TPR_DESCRIP as T_TDOC_DESC, " . "M.MUNI_CODI as M_MUNI_CODI, " . "M.MUNI_NOMB as M_MUNI_NOMB, " . "D.DPTO_CODI as D_DPTO_CODI, " . "D.DPTO_NOMB as D_DPTO_NOMB, " . "T1.TDID_CODI as T1_TDID_CODI, " . "T1.TDID_DESC as T1_TDID_DESC, " . "T2.TRTE_CODI as T2_TRTE_CODI, " . "T2.TRTE_DESC as T2_TRTE_DESC, " . "M1.MREC_CODI as M1_MREC_CODI, " . "M1.MREC_DESC as M1_MREC_DESC, " . "U.USUA_CODI as U_USUA_CODI, " . "U.USUA_LOGIN as U_USUA_LOGIN, " . "U.USUA_NOMB as U_USUA_NOMB, " . "D1.DEPE_CODI as D1_DEPE_CODI, " . "D1.DEPE_NOMB as D1_DEPE_NOMB, " . "D2.DEPE_CODI as D2_DEPE_CODI, " . "D2.DEPE_NOMB as D2_DEPE_NOMB, " . "U1.USUA_CODI as U1_USUA_CODI, " . "U1.USUA_LOGIN as U1_USUA_LOGIN " . " from RADICADO R, SGD_TPR_TPDCUMENTO T, MUNICIPIO M, DEPARTAMENTO D, TIPO_DOC_IDENTIFICACION T1, TIPO_REMITENTE T2, MEDIO_RECEPCION M1, USUARIO U, DEPENDENCIA D1, DEPENDENCIA D2, USUARIO U1" . " where T.SGD_TPR_CODIGO=R.TDOC_CODI and M.MUNI_CODI=R.MUNI_CODI and D.DPTO_CODI=R.DPTO_CODI and T1.TDID_CODI=R.TDID_CODI and T2.TRTE_CODI=R.TRTE_CODI and M1.MREC_CODI=R.MREC_CODI and U.USUA_CODI(+)=R.RADI_USUA_ACTU and D1.DEPE_CODI(+)=R.RADI_DEPE_ACTU and D2.DEPE_CODI=R.RADI_DEPE_RADI and U1.USUA_CODI=R.RADI_USUA_RADI  ";
    //-------------------------------
    //-------------------------------
    // detalle Open Event begin
    $sWhere .= " AND M.DPTO_CODI=D.DPTO_CODI AND U.DEPE_CODI=D1.DEPE_CODI AND U1.DEPE_CODI=D2.DEPE_CODI ";
    // detalle Open Event end
    //-------------------------------
    //-------------------------------
    // Assemble full SQL statement
    //-------------------------------
    $sSQL .= $sWhere . $sOrder;
    //-------------------------------
    //-------------------------------
    // Execute SQL statement
    //-------------------------------
    $db->query($sSQL);
    $next_record = $db->next_record();
    //-------------------------------
    //  echo $sSQL;
    //-------------------------------
    // Create field variables based on database fields
    //-------------------------------
    $fldCARP_CODI = $db->f("R_CARP_CODI");
    $fldCPOB_CODI = $db->f("R_CPOB_CODI");
    $fldCODI_NIVEL = $db->f("R_CODI_NIVEL");
    $fldDPTO_CODI = $db->f("D_DPTO_NOMB");
    $fldEESP_CODI = $db->f("R_EESP_CODI");
    $fldESTA_CODI = $db->f("R_ESTA_CODI");
    $fldMREC_CODI = $db->f("M1_MREC_DESC");
    $fldMUNI_CODI = $db->f("M_MUNI_NOMB");
    $fldRA_ASUN = $db->f("R_RA_ASUN");
    $fldRADI_DEPE_ACTU = $db->f("D1_DEPE_NOMB");
    $fldRADI_DEPE_RADI = $db->f("D2_DEPE_NOMB");
    $fldRADI_DESC_ANEX = $db->f("R_RADI_DESC_ANEX");
    $fldRADI_DIRE_CORR = $db->f("R_RADI_DIRE_CORR");
    $fldRADI_FECH_ASIG = $db->f("R_RADI_FECH_ASIG");
    $fldRADI_FECH_RADI = $db->f("R_RADI_FECH_RADI");
    $fldRADI_NOMB = $db->f("R_RADI_NOMB");
    $fldRADI_NUME_DERI = $db->f("R_RADI_NUME_DERI");
    $fldRADI_NUME_HOJA = $db->f("R_RADI_NUME_HOJA");
    $fldRADI_NUME_IDEN = $db->f("R_RADI_NUME_IDEN");
    $fldRADI_NUME_RADI_URLLink = $db->f("R_RADI_PATH");
    $fldRADI_NUME_RADI = $db->f("R_RADI_NUME_RADI");
    $fldRADI_PAIS = $db->f("R_RADI_PAIS");
    $fldRADI_PATH = $db->f("R_RADI_PATH");
    $fldRADI_PRIM_APEL = $db->f("R_RADI_PRIM_APEL");
    $fldRADI_REM = $db->f("R_RADI_REM");
    $fldRADI_SEGU_APEL = $db->f("R_RADI_SEGU_APEL");
    $fldRADI_TELE_CONT = $db->f("R_RADI_TELE_CONT");
    $fldRADI_TIPO_EMPR = $db->f("R_RADI_TIPO_EMPR");
    $fldRADI_USU_ANTE = $db->f("R_RADI_USU_ANTE");
    $fldRADI_USUA_ACTU = $db->f("U_USUA_NOMB");
    $fldRADI_USUA_RADI = $db->f("U1_USUA_LOGIN");
    $fldTDID_CODI = $db->f("T1_TDID_DESC");
    $fldTDOC_CODI = $db->f("T_TDOC_DESC");
    $fldTRTE_CODI = $db->f("T2_TRTE_DESC");
    //-------------------------------
    // detalle Show begin
    //-------------------------------
    //-------------------------------
    // detalle Show Event begin
    $fldRADI_DEPE_RADI = $db->f("R_RADI_DEPE_RADI") . " - " . $db->f("D2_DEPE_NOMB");
    $fldRADI_NUME_RADI_URLLink = "../bodega" . $db->f("R_RADI_PATH");
    // detalle Show Event end
    //-------------------------------
    $next_record = $db->next_record();
    echo "<tr><td>{$fldRADI_NUME_HOJA}<td><tr>";
    error_reporting(0);
    include "../jh_class/funciones_sgd.php";
    $verrad = $ps_RADI_NUME_RADI;
    $numrad = $ps_RADI_NUME_RADI;
    $ruta_raiz = "..";
    $no_tipo = "true";
    include "../config.php";
    include "../ver_datosrad.php";
    $a = new LOCALIZACION($codep_us1, $muni_us1, "..");
    $muni_nombre_us1 = $a->municipio;
    $dpto_nombre_us1 = $a->departamento;
    $a = new LOCALIZACION($codep_us2, $muni_us2, "..");
    $muni_nombre_us2 = $a->municipio;
    $dpto_nombre_us2 = $a->departamento;
    $a = new LOCALIZACION($codep_us3, $muni_us3, "..");
    $muni_nombre_us3 = $a->municipio;
    $dpto_nombre_us3 = $a->departamento;
    //-------------------------------
    // Process the HTML controls
    //-------------------------------
    ?>
      <tr>
       <td class="ColumnTD"><font class="ColumnFONT">Radicado</font></td><td class="DataTD"><font class="DataFONT">

<?php 
    error_reporting(7);
    if ($radi_path == "") {
        echo "<font class=\\DataFONT\\>{$verrad}</font>";
    } else {
        echo "<a href='../bodega{$radi_path}'><font class=\\DataFONT\\>{$verrad}</font> </a>";
    }
    ?>

&nbsp;</font></td>
      </tr>
      <tr>
       <td class="ColumnTD"><font class="ColumnFONT">Fecha Radicación</font></td><td class="DataTD"><font class="DataFONT">
      <?php 
    echo $radi_fech_radi;
    ?>
&nbsp;</font></td>
      </tr>
      <tr>
       <td class="ColumnTD" bgcolor="#999999"><font class="ColumnFONT">Datos Rem 1</font></td><td bgcolor="#CFCFCF"><font class="DataFONT">
      <?php 
    echo tohtml($nombret_us1);
    ?>
&nbsp;</font></td> 
      </tr>
      <tr>
       <td class="ColumnTD"><font class="ColumnFONT">Dirección</font></td><td class="DataTD"><font class="DataFONT">
      <?php 
    echo tohtml($direccion_us1);
    ?>
&nbsp;</font></td> 
      </tr>	
      <tr>
       <td class="ColumnTD"><font class="ColumnFONT">Numero Identificación</font></td><td class="DataTD"><font class="DataFONT">
      <?php 
    echo tohtml($cc_documento_us1);
    ?>
&nbsp;</font></td>
      </tr>
      <tr>
       
    <td class="ColumnTD"><font class="ColumnFONT">Municipio / Departamento</font></td>
<td class="DataTD"><font class="DataFONT">
      <?php 
    echo $muni_nombre_us1 . " / " . $dpto_nombre_us1;
    ?>
&nbsp;</font></td>
      </tr>	  	    
      <tr>
       <td class="ColumnTD"><font class="ColumnFONT">Datos Predio 2</font></td><td bgcolor="#CFCFCF"><font class="DataFONT">
      <?php 
    echo tohtml($nombret_us2);
    ?>
&nbsp;</font></td> 
      </tr>
      <tr>
       <td class="ColumnTD"><font class="ColumnFONT">Dirección Predio</font></td><td class="DataTD"><font class="DataFONT">
      <?php 
    echo tohtml($direccion_us2);
    ?>
&nbsp;</font></td> 
      </tr>	 	  
      <tr>
       <td class="ColumnTD"><font class="ColumnFONT">Numero Identificación</font></td><td class="DataTD"><font class="DataFONT">
      <?php 
    echo tohtml($cc_documento_us2);
    ?>
&nbsp;</font></td>
      </tr>	  
	        <tr>
       
      <td class="ColumnTD"><font class="ColumnFONT">Municipio / Departamento</font></td>
	  <td class="DataTD"><font class="DataFONT">
      <?php 
    echo $muni_nombre_us2 . " / " . $dpto_nombre_us2;
    ?>
&nbsp;</font></td>
      </tr>
	  
      <tr>
       <td class="ColumnTD"><font class="ColumnFONT">Empresa</font></td><td bgcolor="#CFCFCF"><font class="DataFONT">
      <?php 
    echo tohtml($nombret_us3);
    ?>
&nbsp;</font></td> 
      </tr>	  	  
      <tr>
       <td class="ColumnTD"><font class="ColumnFONT">Dirección Empresa</font></td><td class="DataTD"><font class="DataFONT">
      <?php 
    echo tohtml($direccion_us3);
    ?>
&nbsp;</font></td> 
      </tr>	 	  
      <tr>
       <td class="ColumnTD"><font class="ColumnFONT">Numero Identificación Emp</font></td><td class="DataTD"><font class="DataFONT">
      <?php 
    echo tohtml($cc_documento_us3);
    ?>
&nbsp;</font></td>
      </tr>	  
      <tr>
       
    <td class="ColumnTD"><font class="ColumnFONT">Municipio / Departamento</font></td>
<td class="DataTD"><font class="DataFONT">
      <?php 
    echo $muni_nombre_us3 . " / " . $dpto_nombre_us3;
    ?>
&nbsp;</font></td>
      </tr>	  	  
      <tr>
       <td class="ColumnTD"><font class="ColumnFONT">Asunto</font></td><td class="DataTD"><font class="DataFONT">
      <?php 
    echo tohtml($ra_asun);
    ?>
&nbsp;</font></td>
      </tr>
      <tr>
       <td class="ColumnTD"><font class="ColumnFONT">Tipo de Documento</font></td><td class="DataTD"><font class="DataFONT">
      <?php 
    echo tohtml($tpdoc_nombre);
    ?>
&nbsp;</font></td>
      </tr>

       <tr>
       <td class="ColumnTD"><font class="ColumnFONT">Codigo Carpeta</font></td><td class="DataTD"><font class="DataFONT">
      <?php 
    echo tohtml($carpeta);
    ?>
&nbsp;</font></td>
      </tr>
      <tr>
       <td class="ColumnTD"><font class="ColumnFONT">Medio de Recepción</font></td><td class="DataTD"><font class="DataFONT">
      <?php 
    echo tohtml($fldMREC_CODI);
    ?>
&nbsp;</font></td>
      </tr>
      <tr>
       <td class="ColumnTD"><font class="ColumnFONT">Número de Hojas</font></td><td class="DataTD"><font class="DataFONT">
      <?php 
    echo tohtml($fldRADI_NUME_HOJA);
    ?>
&nbsp;</font></td>
      </tr>
      <tr>
       <td class="ColumnTD"><font class="ColumnFONT">Descripción de Anexos</font></td><td class="DataTD"><font class="DataFONT">
      <?php 
    echo tohtml($fldRADI_DESC_ANEX);
    ?>
&nbsp;</font></td>
      </tr>
      <tr>
       
    <td class="ColumnTD"><font class="ColumnFONT">Radicado Padre</font></td>
<td class="DataTD"><font class="DataFONT">
      <?php 
    echo tohtml($radi_nume_deri);
    ?>
&nbsp;</font></td>
      </tr>
      <tr>
       <td class="ColumnTD"><font class="ColumnFONT">Codigo Estado</font></td><td class="DataTD"><font class="DataFONT">
      <?php 
    echo tohtml($fldESTA_CODI);
    ?>
&nbsp;</font></td>
      </tr>
      <tr>
       <td class="ColumnTD"><font class="ColumnFONT">Usuario Anterior</font></td><td class="DataTD"><font class="DataFONT">
      <?php 
    echo tohtml($radi_usua_ante);
    ?>
&nbsp;</font></td>
      </tr>
      <tr>
       <td class="ColumnTD"><font class="ColumnFONT">Usuario Actual</font></td><td class="DataTD"><font class="DataFONT">
	   <?php 
    $ruta_raiz = "..";
    require "../jh_class/funciones_bd.php";
    $kk = new BD("select usua_nomb from usuario where depe_codi={$radi_depe_actu} and usua_codi={$radi_usua_actu}", 0, "..");
    $usua_nomb = $kk->campo;
    ?>
	   
      <?php 
    echo $usua_nomb . " (" . tohtml($radi_usua_actu) . ")";
    ?>
&nbsp;</font></td>
      </tr>
      <tr>
       <td class="ColumnTD"><font class="ColumnFONT">Dependencia Actual</font></td><td class="DataTD"><font class="DataFONT">
	   <?php 
    $kk = new BD("select depe_nomb from dependencia where depe_codi={$radi_depe_actu}", 0, "..");
    $depe_nomb = $kk->campo;
    ?>
      <?php 
    echo $depe_nomb . " (" . tohtml($radi_depe_actu) . ")";
    ?>
&nbsp;</font></td>
      </tr>
      <tr>
       <td class="ColumnTD"><font class="ColumnFONT">Dependencia Radicación</font></td><td class="DataTD"><font class="DataFONT">
	   <?php 
    $kk = new BD("select depe_nomb from dependencia where depe_codi={$radi_depe_radicacion}", 0, "..");
    $depe_nomb = $kk->campo;
    ?>
      <?php 
    echo $depe_nomb . " (" . tohtml($radi_depe_radicacion) . ")";
    ?>
&nbsp;</font></td>
      </tr>
      <tr>
       <td class="ColumnTD"><font class="ColumnFONT">Dependencia Inicial</font></td><td class="DataTD"><font class="DataFONT">
	   <?php 
    $kk = new BD("select depe_nomb from dependencia where depe_codi={$radi_depe_radi}", 0, "..");
    $depe_nomb = $kk->campo;
    ?>
      
	  <?php 
    echo $depe_nomb . " (" . tohtml($radi_depe_radi) . ")";
    ?>
&nbsp;</font></td>
      </tr>	  
      <tr>
       <td class="ColumnTD"><font class="ColumnFONT">Usuario Radicador</font></td><td class="DataTD"><font class="DataFONT">
      <?php 
    ?>
&nbsp;</font></td>
      </tr>
      <tr>
       <td class="ColumnTD"><font class="ColumnFONT">Historial</font></td>
	   
    <td class="DataTD"><font class="DataFONT"><a href='historico.php?radicado=<?php 
    echo $nurad . "&" . session_name() . "=" . session_id();
    ?>
'> 
      Ver Histórico&nbsp;</a></font></td>
      </tr>
	  </TABLE>
<?php 
    //-------------------------------
    // Finish form processing
    //-------------------------------
    //-------------------------------
    // detalle Close Event begin
    // detalle Close Event end
    //-------------------------------
}
Пример #22
0
function D_PRESTAMO_show()
{
    global $db;
    global $sAction;
    global $sForm;
    global $sFileName;
    global $sPRESTAMOErr;
    global $styles;
    $fldPRES_ID = "";
    $fldPRES_FECH_DEVO = "";
    $fldPRES_DESC = "";
    $fldPRES_ESTADO = "";
    //-------------------------------
    // PRESTAMO Show begin
    //-------------------------------
    $sFormTitle = "Devolucion";
    $sWhere = "";
    $bPK = true;
    ?>
   
   <table class="FormTABLE">
   <form method="POST" action="<?php 
    echo $sFileName;
    ?>
" name="PRESTAMO">
   <tr><td class="FormHeaderTD" colspan="2"><font class="FormHeaderFONT"><?php 
    echo $sFormTitle;
    ?>
</font></td></tr>
   <?php 
    if ($sPRESTAMOErr) {
        ?>
		<tr><td class="DataTD" colspan="2"><font class="DataFONT"><?php 
        echo $sPRESTAMOErr;
        ?>
</font></td></tr>
	 <?php 
    }
    //-------------------------------
    // Load primary key and form parameters
    //-------------------------------
    if ($sPRESTAMOErr == "") {
        $fldPRES_ID = get_param("PRES_ID");
        $pPRES_ID = get_param("PRES_ID");
    } else {
        $fldPRES_ID = strip(get_param("PRES_ID"));
        $fldPRES_FECH_DEVO = strip(get_param("PRES_FECH_DEVO"));
        $fldPRES_DESC = strip(get_param("PRES_DESC"));
        $fldPRES_ESTADO = strip(get_param("PRES_ESTADO"));
        $pPRES_ID = get_param("PK_PRES_ID");
    }
    //-------------------------------
    //-------------------------------
    // Load all form fields
    //-------------------------------
    //-------------------------------
    // Build WHERE statement
    //-------------------------------
    if (!strlen($pPRES_ID)) {
        $bPK = false;
    }
    $sWhere .= "PRES_ID=" . tosql($pPRES_ID, "Number");
    //-------------------------------
    //-------------------------------
    // PRESTAMO Open Event begin
    // PRESTAMO Open Event end
    //-------------------------------
    //-------------------------------
    // Build SQL statement and execute query
    //-------------------------------
    $sSQL = "select * from PRESTAMO where " . $sWhere;
    // Execute SQL statement
    $rs = $db->query($sSQL);
    $bIsUpdateMode = $bPK && !($sAction == "insert" && $sForm == "PRESTAMO") && ($rs && !$rs->EOF);
    //-------------------------------
    //-------------------------------
    // Load all fields into variables from recordset or input parameters
    //-------------------------------
    if ($bIsUpdateMode) {
        $fldPRES_ID = $rs->fields["PRES_ID"];
        //-------------------------------
        // Load data from recordset when form displayed first time
        //-------------------------------
        if ($sPRESTAMOErr == "") {
            $fldPRES_FECH_DEVO = $rs->fields["PRES_FECH_DEVO"];
            $fldPRES_DESC = $rs->fields["PRES_DESC"];
            $fldPRES_ESTADO = $rs->fields["PRES_ESTADO"];
        }
        //-------------------------------
        // PRESTAMO ShowEdit Event begin
        // PRESTAMO ShowEdit Event end
        //-------------------------------
    } else {
        if ($sPRESTAMOErr == "") {
            $fldPRES_ID = tohtml(get_param("PRES_ID"));
            $fldPRES_FECH_DEVO = Date('d-M-y');
        }
        //-------------------------------
        // PRESTAMO ShowInsert Event begin
        // PRESTAMO ShowInsert Event end
        //-------------------------------
    }
    if ($sPRESTAMOErr == "") {
        //-------------------------------
        // PRESTAMO Show Event begin
        $fldPRES_FECH_DEVO = Date('d/m/Y h:i');
        // PRESTAMO Show Event end
        //-------------------------------
    }
    //-------------------------------
    // Show form field
    //-------------------------------
    ?>
      <tr>
       <td class="FieldCaptionTD">
         <font class="FieldCaptionFONT">Fecha de devolución</font>
       </td>
       <td class="DataTD">
         <font class="DataFONT"><input type="hidden" name="PRES_FECH_DEVO" maxlength="15" value="<?php 
    echo tohtml($fldPRES_FECH_DEVO);
    ?>
" size="15" ><?php 
    echo $fldPRES_FECH_DEVO;
    ?>
</font>
       </td>
     </tr>
      <tr>
       <td class="FieldCaptionTD">
         <font class="FieldCaptionFONT">Observaciones extras</font>
       </td>
       <td class="DataTD">
         <font class="DataFONT"><textarea name="PRES_DESC" cols="50" rows="5"><?php 
    echo tohtml($fldPRES_DESC);
    ?>
</textarea></font>
       </td>
     </tr>
      <tr>
       <td class="FieldCaptionTD">
         <font class="FieldCaptionFONT">Estado</font>
       </td>
       <td class="DataTD">
         <font class="DataFONT"><select name="PRES_ESTADO">
<?php 
    $LOV = split(";", "3;Devuelto;");
    if (sizeof($LOV) % 2 != 0) {
        $array_length = sizeof($LOV) - 1;
    } else {
        $array_length = sizeof($LOV);
    }
    for ($i = 0; $i < $array_length; $i = $i + 2) {
        if ($LOV[$i] == $fldPRES_ESTADO) {
            $option = "<option SELECTED value=\"" . $LOV[$i] . "\">" . $LOV[$i + 1];
        } else {
            $option = "<option value=\"" . $LOV[$i] . "\">" . $LOV[$i + 1];
        }
        echo $option;
    }
    ?>
</select></font>
       </td>
     </tr>
    <tr><td colspan="2" align="right">
<?php 
    if ($bIsUpdateMode) {
        ?>
  <input type="hidden" value="update" name="FormAction"/>
  <input type="submit" value="Devolver" onclick="document.PRESTAMO.FormAction.value = 'update';">
<?php 
    }
    ?>
  <input type="submit" value="Cancelar" onclick="document.PRESTAMO.FormAction.value = 'cancel';">
  <input type="hidden" name="FormName" value="PRESTAMO">
  
  <input type="hidden" name="PK_PRES_ID" value="<?php 
    echo $pPRES_ID;
    ?>
">  
  <input type="hidden" name="PRES_ID" value="<?php 
    echo tohtml($fldPRES_ID);
    ?>
">
  </td></tr>
  </form>
  </table>
<?php 
    //-------------------------------
    // PRESTAMO Close Event begin
    // PRESTAMO Close Event end
    //-------------------------------
    //-------------------------------
    // PRESTAMO Show end
    //-------------------------------
}
$pschooladdress = tosql(get_param("pschooladdress"), "Text");
$pschoolcity = tosql(get_param("pschoolcity"), "Text");
$pschoolstate = tosql(get_param("pschoolstate"), "Text");
$pschoolzip = tosql(get_param("pschoolzip"), "Text");
$pschoolcountry = tosql(get_param("pschoolcountry"), "Text");
$school = get_param("school");
$homed = get_param("homed");
if ($homed == "") {
    $homed = 0;
}
$grade = get_param("grade");
$current_year_id = $_SESSION['CurrentYear'];
$studentid = get_param("studentid");
$teacher = get_param("teacher");
$homeroom = tosql(get_param("homeroom"), "Text");
$bus = tosql(get_param("bus"), "Text");
//get custom fields
$student_custom_fields = get_param("student_custom_fields");
//array
$custom_fields = get_param("custom_fields");
//array
$new_custom_field_id = get_param("new_custom_field_id");
$new_custom_field_data = get_param("new_custom_field_data");
//get new action entry
$do_new_action = get_param("do_new_action");
$new_action_school = get_param("new_action_school");
$new_action_code = get_param("new_action_code");
$new_action_date = get_param("new_action_date");
$new_action_school_year = get_param("new_action_school_year");
$new_action_notes = get_param("new_action_notes");
$delete_entry_actions = get_param("delete_entry_actions");
        $health_allergy_id = get_param("id");
        if ($norem = $db->get_results("SELECT health_allergy_history_code FROM health_allergy_history WHERE health_allergy_history_code='" . $health_allergy_id . "'")) {
            $msgFormErr = _HEALTH_ALLERGIES_NOT_REMOVED;
        } else {
            $sSQL = "DELETE FROM health_allergy WHERE health_allergy_id='" . $health_allergy_id . "'";
            $db->query($sSQL);
        }
        break;
    case "add":
        $health_allergy_desc = get_param("healthname");
        //Check for duplicates
        $tot = $db->get_var("SELECT count(*) FROM health_allergy \nWHERE health_allergy_desc='" . $health_allergy_desc . "'");
        if ($tot > 0) {
            $msgFormErr = _HEALTH_ALLERGIES_DUP;
        } else {
            $sSQL = "INSERT INTO health_allergy (health_allergy_desc) \nVALUES (" . tosql($health_allergy_desc, "Text") . ")";
            $db->query($sSQL);
        }
        break;
    case "edit":
        $health_allergy_id = get_param("id");
        $sSQL = "SELECT health_allergy_desc FROM health_allergy \nWHERE health_allergy_id={$health_allergy_id}";
        $health_allergy_desc = $db->get_var($sSQL);
        break;
    case "update":
        $health_allergy_id = get_param("id");
        $health_allergy_desc = get_param("healthname");
        $sSQL = "UPDATE health_allergy SET \nhealth_allergy_desc='" . $health_allergy_desc . "' WHERE \nhealth_allergy_id='" . $health_allergy_id . "'";
        $db->query($sSQL);
        break;
}
function DMR_DM_PRESTAMO_show()
{
    global $db;
    global $sAction;
    global $sForm;
    global $sFileName;
    global $sPRESTAMOErr;
    global $styles;
    global $login_err;
    $fldPRES_ID = "";
    $fldRADI_NUME_RADI = "";
    $fldUSUA_LOGIN_ACTU = "";
    $fldDEPE_CODI = "";
    $fldPRES_FECH_PEDI = "";
    $fldPRES_REQUERIMIENTO = "";
    $fldUSUA_LOGIN_PRES = "";
    $fldPRES_FECH_PRES = "";
    $fldPRES_DESC = "";
    $fldPRES_ESTADO = "";
    //-------------------------------
    // PRESTAMO Show begin
    //-------------------------------
    $sFormTitle = "Devolución Masiva";
    $sWhere = "";
    $bPK = true;
    $fldPRES_FECH_DEVO = Date('d/m/Y h:i');
    ?>
   
   <table class="FormTABLE">
   <form method="POST" action="<?php 
    echo $sFileName;
    ?>
" name="PRESTAMO">
   <tr><td class="FormHeaderTD" colspan="2"><font class="FormHeaderFONT"><?php 
    echo $sFormTitle;
    ?>
</font></td></tr>
   <?php 
    if ($sPRESTAMOErr) {
        ?>
		<tr><td class="DataTD" colspan="2"><font class="ErrorFONT"><?php 
        echo $sPRESTAMOErr;
        ?>
</font></td></tr>
	 <?php 
    }
    ?>
    <?php 
    if (strlen($login_err)) {
        ?>
    <tr><td colspan="2"><font Class="ErrorFONT"><?php 
        echo $login_err;
        ?>
</font></td></tr>
    <?php 
    }
    ?>
      <tr>
       <td class="FieldCaptionTD">
         <font class="FieldCaptionFONT">Fecha de devolución</font>
       </td>
       <td class="DataTD">
         <font class="DataFONT"><input type="hidden" name="PRES_FECH_DEVO" maxlength="15" value="<?php 
    echo tohtml($fldPRES_FECH_DEVO);
    ?>
" size="15" ><?php 
    echo $fldPRES_FECH_DEVO;
    ?>
</font>
       </td>
     </tr>

<?php 
    //-------------------------------
    // PRESTAMO Show Event begin
    // PRESTAMO Show Event end
    //-------------------------------
    //-------------------------------
    // Load primary key and form parameters
    //-------------------------------
    if ($sPRESTAMOErr == "") {
        $rqd_PRES_ID = get_param("PRES_ID");
        $pPRES_ID = get_param("PRES_ID");
        $fldUSUA_LOGIN_ACTU = strip(strtoupper(get_param("usuario")));
    } else {
        $fldUSUA_LOGIN_PRES = strip(get_param("USUA_LOGIN_PRES"));
        $fldUSUA_LOGIN_ACTU = strip(get_param("USUA_LOGIN_ACTU"));
        $fldPRES_FECH_PRES = strip(get_param("PRES_FECH_PRES"));
        $pPRES_ID = get_param("PK_PRES_ID");
    }
    //-------------------------------
    //-------------------------------
    // Load all form fields
    //-------------------------------
    //-------------------------------
    // Build WHERE statement
    //-------------------------------
    $usuario = get_param("usuario");
    $usuario = strtoupper($usuario);
    if (!strlen($usuario)) {
        $bPK = false;
    }
    $sWhere .= "USUA_LOGIN_ACTU=" . tosql($usuario, "text") . " AND (PRES_ESTADO=2 OR PRES_ESTADO=5)";
    // Prestado = 2...
    //-------------------------------
    //-------------------------------
    // PRESTAMO Open Event begin
    // PRESTAMO Open Event end
    //-------------------------------
    //-------------------------------
    // Build SQL statement and execute query
    //-------------------------------
    $radiATexto = $db->conn->numToString("RADI_NUME_RADI");
    $sSQL = "select PRES_ID,\n\t\t\t{$radiATexto} as RADI_NUME_RADI,\n\t\t\tUSUA_LOGIN_ACTU,\n\t\t\tDEPE_CODI,\n\t\t\tUSUA_LOGIN_PRES,\n\t\t\tPRES_DESC,\n\t\t\tPRES_FECH_PRES,\n\t\t\tPRES_FECH_DEVO,\n\t\t\tPRES_FECH_PEDI,\n\t\t\tPRES_ESTADO,\n\t\t\tPRES_REQUERIMIENTO,\n\t\t\tPRES_DEPE_ARCH,\n\t\t\tPRES_FECH_VENC\n   from PRESTAMO where " . $sWhere;
    // Execute SQL statement
    $db->conn->SetFetchMode(ADODB_FETCH_ASSOC);
    $rs = $db->query($sSQL);
    $db->conn->SetFetchMode(ADODB_FETCH_NUM);
    //-------------------------------
    //-------------------------------
    // Load lists of values
    //-------------------------------
    $aPRES_REQUERIMIENTO = split(";", "1;Documento;2;Anexo");
    //-------------------------------
    //-------------------------------
    // Load all fields into variables from recordset or input parameters
    //-------------------------------
    $contador = 0;
    while ($bPK && ($rs && !$rs->EOF)) {
        $contador++;
        $fldDEPE_CODI = $rs->fields["DEPE_CODI"];
        $fldPRES_FECH_PEDI = $rs->fields["PRES_FECH_PEDI"];
        $fldPRES_FECH_VENC = $rs->fields["PRES_FECH_VENC"];
        $fldPRES_ID = $rs->fields["PRES_ID"];
        $fldPRES_REQUERIMIENTO = $rs->fields["PRES_REQUERIMIENTO"];
        $fldRADI_NUME_RADI = $rs->fields["RADI_NUME_RADI"];
        $fldUSUA_LOGIN_ACTU = $rs->fields["USUA_LOGIN_ACTU"];
        //-------------------------------
        // Load data from recordset when form displayed first time
        //-------------------------------
        if ($sPRESTAMOErr == "") {
            $fldUSUA_LOGIN_PRES = $rs->fields["USUA_LOGIN_PRES"];
            $fldPRES_FECH_PRES = $rs->fields["PRES_FECH_PRES"];
            $fldPRES_DESC = $rs->fields["PRES_DESC"];
            $fldPRES_ESTADO = $rs->fields["PRES_ESTADO"];
        } else {
            $fldPRES_DESC = strip(get_param("PRES_DESC_" . $contador));
            $fldPRES_ESTADO = strip(get_param("PRES_ESTADO_" . $contador));
            $fldPRES_ID = strip(get_param("PRES_ID_" . $contador));
        }
        //-------------------------------
        // Set lookup fields
        //-------------------------------
        $fldDEPE_CODI = get_db_value("SELECT DEPE_NOMB FROM DEPENDENCIA WHERE DEPE_CODI=" . tosql($fldDEPE_CODI, "Number"));
        //-------------------------------
        // Show form field
        //-------------------------------
        ?>

<tr><td colspan="2"><HR></td></tr>
	<tr>
       <td class="FieldCaptionTD">
         <font class="FieldCaptionFONT">Radicado</font>
       </td>
       <td class="DataTD">
         <font class="DataFONT">
      <?php 
        echo tohtml($fldRADI_NUME_RADI);
        ?>
&nbsp;</font>
       </td>
     </tr>
      <tr>
       <td class="FieldCaptionTD">
         <font class="FieldCaptionFONT">Fecha de Vencimiento</font>
       </td>
       <td class="DataTD">
         <font class="DataFONT"><?php 
        echo $fldPRES_FECH_VENC;
        ?>
</font>
       </td>
     </tr>
      <tr>
       <td class="FieldCaptionTD">
         <font class="FieldCaptionFONT">Requerimiento</font>
       </td>
       <td class="DataTD">
         <font class="DataFONT">
      <?php 
        $fldPRES_REQUERIMIENTO = get_lov_value($fldPRES_REQUERIMIENTO, $aPRES_REQUERIMIENTO);
        ?>
      <?php 
        echo tohtml($fldPRES_REQUERIMIENTO);
        ?>
&nbsp;</font>
       </td>
     </tr>
      <tr>
       <td class="FieldCaptionTD">
         <font class="FieldCaptionFONT">Observaciones extras</font>
       </td>
       <td class="DataTD"><?php 
        $nombreCampo = "PRES_DESC_" . $contador;
        ?>
         <font class="DataFONT"><textarea name="<?php 
        echo $nombreCampo;
        ?>
" cols="50" rows="5"><?php 
        echo tohtml($fldPRES_DESC);
        ?>
</textarea></font>
       </td>
     </tr>
      <tr>
       <td class="FieldCaptionTD">
         <font class="FieldCaptionFONT">Estado</font>
       </td>
       <td class="DataTD"><?php 
        $nombreCampo = "PRES_ESTADO_" . $contador;
        ?>
         <font class="DataFONT"><select name="<?php 
        echo $nombreCampo;
        ?>
">
<?php 
        $LOV = split(";", "3;Devolver;1;No hacer nada;");
        if (sizeof($LOV) % 2 != 0) {
            $array_length = sizeof($LOV) - 1;
        } else {
            $array_length = sizeof($LOV);
        }
        for ($i = 0; $i < $array_length; $i = $i + 2) {
            if ($LOV[$i] == $fldPRES_ESTADO) {
                $option = "<option SELECTED value=\"" . $LOV[$i] . "\">" . $LOV[$i + 1];
            } else {
                $option = "<option value=\"" . $LOV[$i] . "\">" . $LOV[$i + 1];
            }
            echo $option;
        }
        ?>
</select></font>
       </td>
     </tr>

<?php 
        $nombreCampo = "PRES_ID_" . $contador;
        ?>
  <input type="hidden" name="<?php 
        echo $nombreCampo;
        ?>
" value="<?php 
        echo tohtml($fldPRES_ID);
        ?>
">
<?php 
        $rs->MoveNext();
    }
    if ($contador == 0) {
        ?>
	<tr><td colspan="2"><HR></td></tr>
	<tr><td colspan="2"><font class="DataFONT">No hay documentos para prestar</font></td></tr>
<?php 
    }
    ?>

    <tr><td colspan="2" align="right">
<?php 
    if ($bPK && $contador != 0) {
        ?>
  <input type="hidden" value="update" name="FormAction"/>
  <input type="submit" value="Devolver/Cancelar" onclick="document.PRESTAMO.FormAction.value = 'update';">
<?php 
    }
    ?>
  <input type="submit" value="No hacer nada" onclick="document.PRESTAMO.FormAction.value = 'cancel';">
  <input type="hidden" name="FormName" value="DEVOLVER">
  <input type="hidden" name="NumContador" value="<?php 
    echo $contador;
    ?>
">
  
  </td></tr>
  </form>
  </table>
<?php 
    //-------------------------------
    // PRESTAMO Close Event begin
    // PRESTAMO Close Event end
    //-------------------------------
    //-------------------------------
    // PRESTAMO Show end
    //-------------------------------
}
Пример #26
0
function PRESTAMO_show()
{
    //-------------------------------
    // Initialize variables
    //-------------------------------
    global $db;
    global $sPRESTAMOErr;
    global $sFileName;
    global $styles;
    $sWhere = "";
    $sOrder = "";
    $sSQL = "";
    $sFormTitle = "Documentos Prestados";
    $HasParam = false;
    $iRecordsPerPage = 20;
    $iCounter = 0;
    $iPage = 0;
    $bEof = false;
    $iSort = "";
    $iSorted = "";
    $sDirection = "";
    $sSortParams = "";
    $iTmpI = 0;
    $iTmpJ = 0;
    $sCountSQL = "";
    $transit_params = "";
    $form_params = "s_RADI_NUME_RADI=" . tourl(get_param("s_RADI_NUME_RADI")) . "&";
    //-------------------------------
    // Build ORDER BY statement
    //-------------------------------
    $iSort = get_param("FormPRESTAMO_Sorting");
    $iSorted = get_param("FormPRESTAMO_Sorted");
    if (!$iSort) {
        $form_sorting = "";
    } else {
        if ($iSort == $iSorted) {
            $form_sorting = "";
            $sDirection = " DESC";
            $sSortParams = "FormPRESTAMO_Sorting=" . $iSort . "&FormPRESTAMO_Sorted=" . $iSort . "&";
        } else {
            $form_sorting = $iSort;
            $sDirection = " ASC";
            $sSortParams = "FormPRESTAMO_Sorting=" . $iSort . "&FormPRESTAMO_Sorted=" . "&";
        }
        if ($iSort == 1) {
            $sOrder = " order by P.RADI_NUME_RADI" . $sDirection;
        }
        if ($iSort == 2) {
            $sOrder = " order by P.USUA_LOGIN_ACTU" . $sDirection;
        }
        if ($iSort == 3) {
            $sOrder = " order by D.DEPE_NOMB" . $sDirection;
        }
        if ($iSort == 4) {
            $sOrder = " order by P.USUA_LOGIN_PRES" . $sDirection;
        }
        if ($iSort == 5) {
            $sOrder = " order by P.PRES_DESC" . $sDirection;
        }
        if ($iSort == 6) {
            $sOrder = " order by P.PRES_FECH_PRES" . $sDirection;
        }
        if ($iSort == 7) {
            $sOrder = " order by P.PRES_FECH_DEVO" . $sDirection;
        }
        if ($iSort == 8) {
            $sOrder = " order by P.PRES_FECH_PEDI" . $sDirection;
        }
        if ($iSort == 9) {
            $sOrder = " order by P.PRES_ESTADO" . $sDirection;
        }
        if ($iSort == 10) {
            $sOrder = " order by P.PRES_REQUERIMIENTO" . $sDirection;
        }
        if ($iSort == 11) {
            $sOrder = " order by P.PRES_FECH_VENC" . $sDirection;
        }
    }
    //-------------------------------
    // HTML column headers
    //-------------------------------
    ?>
     <table class="FormTABLE">
      <tr>
       <td class="FormHeaderTD" colspan="10"><a name="PRESTAMO"><font class="FormHeaderFONT"><?php 
    echo $sFormTitle;
    ?>
</font></a></td>
      </tr>
      <tr>
       <td class="ColumnTD"><a href="<?php 
    echo $sFileName;
    ?>
?<?php 
    echo $form_params;
    ?>
FormPRESTAMO_Sorting=1&FormPRESTAMO_Sorted=<?php 
    echo $form_sorting;
    ?>
&"><font class="ColumnFONT">Radicado</font></a></td>
       <td class="ColumnTD"><a href="<?php 
    echo $sFileName;
    ?>
?<?php 
    echo $form_params;
    ?>
FormPRESTAMO_Sorting=2&FormPRESTAMO_Sorted=<?php 
    echo $form_sorting;
    ?>
&"><font class="ColumnFONT">Solicitó</font></a></td>
       <td class="ColumnTD"><a href="<?php 
    echo $sFileName;
    ?>
?<?php 
    echo $form_params;
    ?>
FormPRESTAMO_Sorting=3&FormPRESTAMO_Sorted=<?php 
    echo $form_sorting;
    ?>
&"><font class="ColumnFONT">Dependencia</font></a></td>
       <td class="ColumnTD"><a href="<?php 
    echo $sFileName;
    ?>
?<?php 
    echo $form_params;
    ?>
FormPRESTAMO_Sorting=4&FormPRESTAMO_Sorted=<?php 
    echo $form_sorting;
    ?>
&"><font class="ColumnFONT">Prestó</font></a></td>
       <td class="ColumnTD"><a href="<?php 
    echo $sFileName;
    ?>
?<?php 
    echo $form_params;
    ?>
FormPRESTAMO_Sorting=5&FormPRESTAMO_Sorted=<?php 
    echo $form_sorting;
    ?>
&"><font class="ColumnFONT">Descripción</font></a></td>
       <td class="ColumnTD"><a href="<?php 
    echo $sFileName;
    ?>
?<?php 
    echo $form_params;
    ?>
FormPRESTAMO_Sorting=8&FormPRESTAMO_Sorted=<?php 
    echo $form_sorting;
    ?>
&"><font class="ColumnFONT">Solicitado el</font></a></td>
       <td class="ColumnTD"><a href="<?php 
    echo $sFileName;
    ?>
?<?php 
    echo $form_params;
    ?>
FormPRESTAMO_Sorting=6&FormPRESTAMO_Sorted=<?php 
    echo $form_sorting;
    ?>
&"><font class="ColumnFONT">Prestado el</font></a></td>
       <td class="ColumnTD"><a href="<?php 
    echo $sFileName;
    ?>
?<?php 
    echo $form_params;
    ?>
FormPRESTAMO_Sorting=11&FormPRESTAMO_Sorted=<?php 
    echo $form_sorting;
    ?>
&"><font class="ColumnFONT">Vence</font></a></td>
       <td class="ColumnTD"><a href="<?php 
    echo $sFileName;
    ?>
?<?php 
    echo $form_params;
    ?>
FormPRESTAMO_Sorting=10&FormPRESTAMO_Sorted=<?php 
    echo $form_sorting;
    ?>
&"><font class="ColumnFONT">Requerimiento</font></a></td>
       <td class="ColumnTD"><font class="ColumnFONT">Renovar</font></td>
      </tr>
<?php 
    //-------------------------------
    // Build WHERE statement
    //-------------------------------
    $ps_RADI_NUME_RADI = get_param("s_RADI_NUME_RADI");
    if (is_number($ps_RADI_NUME_RADI) && strlen($ps_RADI_NUME_RADI)) {
        $ps_RADI_NUME_RADI = tosql($ps_RADI_NUME_RADI, "Number");
    } else {
        $ps_RADI_NUME_RADI = "";
    }
    if (strlen($ps_RADI_NUME_RADI)) {
        $HasParam = true;
        $sWhere = "P.RADI_NUME_RADI like ('%" . $ps_RADI_NUME_RADI . "%') or " . "P.USUA_LOGIN_ACTU like " . tosql("%" . $ps_RADI_NUME_RADI . "%", "Text");
    }
    if ($HasParam) {
        $sWhere = " AND (" . $sWhere . ")";
    }
    //-------------------------------
    // Build base SQL statement
    //-------------------------------
    $radiATexto = $db->conn->numToString("P.RADI_NUME_RADI");
    $sSQL = "select P.DEPE_CODI as P_DEPE_CODI, " . "P.PRES_DESC as P_PRES_DESC, " . "P.PRES_ESTADO as P_PRES_ESTADO, " . "P.PRES_FECH_PEDI as P_PRES_FECH_PEDI, " . "P.PRES_FECH_PRES as P_PRES_FECH_PRES, " . "P.PRES_FECH_VENC as P_PRES_FECH_VENC, " . "P.PRES_ID as P_PRES_ID, " . "P.PRES_REQUERIMIENTO as P_PRES_REQUERIMIENTO, " . " {$radiATexto} as P_RADI_NUME_RADI, " . "P.USUA_LOGIN_ACTU as P_USUA_LOGIN_ACTU, " . "P.USUA_LOGIN_PRES as P_USUA_LOGIN_PRES, " . "D.DEPE_CODI as D_DEPE_CODI, " . "D.DEPE_NOMB as D_DEPE_NOMB " . " from PRESTAMO P, DEPENDENCIA D" . " where D.DEPE_CODI=P.DEPE_CODI  ";
    //-------------------------------
    //-------------------------------
    // PRESTAMO Open Event begin
    $depe = get_session("Dependencia");
    $sWhere .= " AND (P.PRES_ESTADO=2 OR P.PRES_ESTADO=5) AND PRES_DEPE_ARCH=" . $depe;
    // PRESTAMO Open Event end
    //-------------------------------
    //-------------------------------
    // Assemble full SQL statement
    //-------------------------------
    $sSQL .= $sWhere . $sOrder;
    if ($sCountSQL == "") {
        $iTmpI = strpos(strtolower($sSQL), "select");
        $iTmpJ = strpos(strtolower($sSQL), "from") - 1;
        $sCountSQL = str_replace(substr($sSQL, $iTmpI + 6, $iTmpJ - $iTmpI - 6), " count(*) ", $sSQL);
        $iTmpI = strpos(strtolower($sCountSQL), "order by");
        if ($iTmpI > 1) {
            $sCountSQL = substr($sCountSQL, 0, $iTmpI - 1);
        }
    }
    //-------------------------------
    //-------------------------------
    // Execute SQL statement
    //-------------------------------
    $db->conn->SetFetchMode(ADODB_FETCH_ASSOC);
    $rs = $db->query($sSQL);
    $db->conn->SetFetchMode(ADODB_FETCH_NUM);
    //-------------------------------
    // Process empty recordset
    //-------------------------------
    if (!$rs || $rs->EOF) {
        ?>
     <tr>
      <td colspan="10" class="DataTD"><font class="DataFONT">No hay Registros</font></td>
     </tr>
<?php 
        //-------------------------------
        //  The insert link.
        //-------------------------------
        ?>
    <tr>
     <td colspan="10" class="ColumnTD"><font class="ColumnFONT">
<?php 
        ?>
  </table>
<?php 
        return;
    }
    //-------------------------------
    //-------------------------------
    // Prepare the lists of values
    //-------------------------------
    $aPRES_ESTADO = split(";", "1;Pedido;2;Prestado;3;Devuelto;4;Cancelado;5;Prestamo Indefinido");
    $aPRES_REQUERIMIENTO = split(";", "1;Documento;2;Anexo");
    //-------------------------------
    //-------------------------------
    // Initialize page counter and records per page
    //-------------------------------
    $iRecordsPerPage = 20;
    $iCounter = 0;
    //-------------------------------
    //-------------------------------
    // Process page scroller
    //-------------------------------
    $iPage = get_param("FormPRESTAMO_Page");
    $db_count = get_db_value($sCountSQL);
    $dResult = intval($db_count) / $iRecordsPerPage;
    $iPageCount = intval($dResult);
    if ($iPageCount < $dResult) {
        $iPageCount = $iPageCount + 1;
    }
    $iTotalPages = $iPageCount;
    if (!strlen($iPage)) {
        $iPage = 1;
    } else {
        if ($iPage == "last") {
            $iPage = $iPageCount;
        }
    }
    if (($iPage - 1) * $iRecordsPerPage != 0) {
        do {
            $iCounter++;
            $rs->MoveNext();
        } while ($iCounter < ($iPage - 1) * $iRecordsPerPage && !$rs->EOF);
    }
    $iCounter = 0;
    //-------------------------------
    //-------------------------------
    // Display grid based on recordset
    //-------------------------------
    while ($rs && !$rs->EOF && $iCounter < $iRecordsPerPage) {
        //-------------------------------
        // Create field variables based on database fields
        //-------------------------------
        $fldDEPE_CODI = $rs->fields["D_DEPE_NOMB"];
        $fldPRES_DESC = $rs->fields["P_PRES_DESC"];
        $fldPRES_ESTADO = $rs->fields["P_PRES_ESTADO"];
        $fldPRES_FECH_DEVO = $rs->fields["P_PRES_FECH_DEVO"];
        $fldPRES_FECH_PEDI = $rs->fields["P_PRES_FECH_PEDI"];
        $fldPRES_FECH_PRES = $rs->fields["P_PRES_FECH_PRES"];
        $fldPRES_FECH_VENC = $rs->fields["P_PRES_FECH_VENC"];
        $fldPRES_ID = $rs->fields["P_PRES_ID"];
        $fldPRES_REQUERIMIENTO = $rs->fields["P_PRES_REQUERIMIENTO"];
        $fldRADI_NUME_RADI_URLLink = "devolver.php";
        $fldRADI_NUME_RADI_PRES_ID = $rs->fields["P_PRES_ID"];
        $fldRADI_NUME_RADI = $rs->fields["P_RADI_NUME_RADI"];
        $fldUSUA_LOGIN_ACTU = $rs->fields["P_USUA_LOGIN_ACTU"];
        $fldUSUA_LOGIN_PRES = $rs->fields["P_USUA_LOGIN_PRES"];
        $rs->MoveNext();
        //-------------------------------
        // PRESTAMO Show begin
        //-------------------------------
        //-------------------------------
        // PRESTAMO Show Event begin
        // PRESTAMO Show Event end
        //-------------------------------
        //-------------------------------
        // Process the HTML controls
        //-------------------------------
        ?>
      <tr>
       <td class="DataTD"><font class="DataFONT"><a href="<?php 
        echo $fldRADI_NUME_RADI_URLLink;
        ?>
?PRES_ID=<?php 
        echo $fldRADI_NUME_RADI_PRES_ID;
        ?>
&<?php 
        echo $transit_params;
        ?>
"><font class="DataFONT"><?php 
        echo $fldRADI_NUME_RADI;
        ?>
</font></a>&nbsp;</font></td>
       <td class="DataTD"><font class="DataFONT">
      <?php 
        echo tohtml($fldUSUA_LOGIN_ACTU);
        ?>
&nbsp;</font></td>
       <td class="DataTD"><font class="DataFONT">
      <?php 
        echo tohtml($fldDEPE_CODI);
        ?>
&nbsp;</font></td>
       <td class="DataTD"><font class="DataFONT">
      <?php 
        echo tohtml($fldUSUA_LOGIN_PRES);
        ?>
&nbsp;</font></td>
       <td class="DataTD"><font class="DataFONT">
      <?php 
        echo tohtml($fldPRES_DESC);
        ?>
&nbsp;</font></td>
       <td class="DataTD"><font class="DataFONT">
      <?php 
        echo tohtml($fldPRES_FECH_PEDI);
        ?>
&nbsp;</font></td>
       <td class="DataTD"><font class="DataFONT">
      <?php 
        echo tohtml($fldPRES_FECH_PRES);
        ?>
&nbsp;</font></td>
       <td class="DataTD"><font class="DataFONT">
      <?php 
        echo tohtml($fldPRES_FECH_VENC);
        ?>
&nbsp;</font></td>
       <td class="DataTD"><font class="DataFONT">
      <?php 
        $fldPRES_REQUERIMIENTO = get_lov_value($fldPRES_REQUERIMIENTO, $aPRES_REQUERIMIENTO);
        ?>
      <?php 
        echo tohtml($fldPRES_REQUERIMIENTO);
        ?>
&nbsp;</font></td>
       <td class="DataTD"><font class="DataFONT"><a href="renovar.php?PRES_ID=<?php 
        echo $fldRADI_NUME_RADI_PRES_ID;
        ?>
&<?php 
        echo $transit_params;
        ?>
"><font class="DataFONT">Renovar</font></a>&nbsp;</font></td>
      </tr><?php 
        //-------------------------------
        // PRESTAMO Show end
        //-------------------------------
        //-------------------------------
        // Move to the next record and increase record counter
        //-------------------------------
        $iCounter++;
    }
    //-------------------------------
    //  Grid. The insert link and record navigator.
    //-------------------------------
    ?>
    <tr>
     <td colspan="10" class="ColumnTD"><font class="ColumnFONT">
<?php 
    // PRESTAMO Navigation begin
    if ($rs || !$rs->EOF || $iPage != 1) {
        $iCounter = 1;
        $iHasPages = $iPage;
        $sPages = "";
        $iDisplayPages = 0;
        $iNumberOfPages = 10;
        $iHasPages = $iPageCount;
        if ($iHasPages - $iPage < intval($iNumberOfPages / 2)) {
            $iStartPage = $iHasPages - $iNumberOfPages;
        } else {
            $iStartPage = $iPage - $iNumberOfPages + intval($iNumberOfPages / 2);
        }
        if ($iStartPage < 0) {
            $iStartPage = 0;
        }
        for ($iPageCount = $iStartPage + 1; $iPageCount <= $iPage - 1; $iPageCount++) {
            $sPages .= "<a href=\"{$sFileName}?{$form_params}{$sSortParams}{$FormPRESTAMO_Page}={$iPageCount}#PRESTAMO\"><font " . "class=\"ColumnFONT\"" . ">" . $iPageCount . "</font></a>&nbsp;";
            $iDisplayPages++;
        }
        $sPages .= "<font " . "class=\"ColumnFONT\"" . ">" . $iPage . "</font>&nbsp;";
        $iDisplayPages++;
        $iPageCount = $iPage + 1;
        while ($iDisplayPages < $iNumberOfPages && $iStartPage + $iDisplayPages < $iHasPages) {
            $sPages .= "<a href=\"" . $sFileName . "?" . $form_params . $sSortParams . "FormPRESTAMO_Page=" . $iPageCount . "#PRESTAMO\"><font " . "class=\"ColumnFONT\"" . ">" . $iPageCount . "</font></a>&nbsp;";
            $iDisplayPages++;
            $iPageCount++;
        }
        if ($iPage == 1) {
            ?>
        <font class="ColumnFONT">Primero</font>
        <font class="ColumnFONT">Anterior</font>
<?php 
        } else {
            ?>
        <a href="<?php 
            echo $sFileName;
            ?>
?<?php 
            echo $form_params;
            echo $sSortParams;
            ?>
FormPRESTAMO_Page=1#PRESTAMO"><font class="ColumnFONT">Primero</font></a>
        <a href="<?php 
            echo $sFileName;
            ?>
?<?php 
            echo $form_params;
            echo $sSortParams;
            ?>
FormPRESTAMO_Page=<?php 
            echo $iPage - 1;
            ?>
#PRESTAMO"><font class="ColumnFONT">Anterior</font></a>
<?php 
        }
        echo "&nbsp;[&nbsp;" . $sPages . "of " . $iTotalPages . "&nbsp;" . "]&nbsp;";
        if (!$bEof) {
            ?>
        <font class="ColumnFONT">Siguiente</font>
        <font class="ColumnFONT">Ultimo</font>
<?php 
        } else {
            ?>
        <a href="<?php 
            echo $sFileName;
            ?>
?<?php 
            echo $form_params;
            echo $sSortParams;
            ?>
FormPRESTAMO_Page=<?php 
            echo $iPage + 1;
            ?>
#PRESTAMO"><font class="ColumnFONT">Siguiente</font></a>
        <a href="<?php 
            echo $sFileName;
            ?>
?<?php 
            echo $form_params;
            echo $sSortParams;
            ?>
FormPRESTAMO_Page=last#PRESTAMO"><font class="ColumnFONT">Ultimo</font></a>
<?php 
        }
    }
    //-------------------------------
    // PRESTAMO Navigation end
    //-------------------------------
    //-------------------------------
    // Finish form processing
    //-------------------------------
    ?>
      </font></td></tr>
    </table>
  <?php 
    //-------------------------------
    // PRESTAMO Close Event begin
    // PRESTAMO Close Event end
    //-------------------------------
}
if (!session_is_registered('UserId') || $_SESSION['UserType'] != "N") {
    header("Location: index.php?action=notauth");
    exit;
}
//Inizialize database functions
include_once "ez_sql.php";
//Include global functions
include_once "common.php";
// config
include_once "configuration.php";
$tfname = $_SESSION['tfname'];
$tlname = $_SESSION['tlname'];
$user_id = $_SESSION['UserId'];
$action = get_param("action");
if ($action == "update") {
    $tpass = tosql(get_param("password"), "Text");
    $sSQL = "UPDATE web_users SET web_users_password='******' WHERE web_users_id='" . $user_id . "'";
    $db->query($sSQL);
} else {
    $sSQL = "SELECT web_users_password FROM web_users WHERE web_users_id='" . $user_id . "'";
    $tpass = $db->get_var($sSQL);
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<title><` echo _BROWSER_TITLE?></title>
<style type="text/css" media="all">@import "student-health.css";</style>
Пример #28
0
function RADICADO_show()
{
    //-------------------------------
    // Initialize variables
    //-------------------------------
    global $db;
    global $sRADICADOErr;
    global $sFileName;
    global $styles;
    $sWhere = "";
    $sOrder = "";
    $sSQL = "";
    $sFormTitle = "Radicados";
    $HasParam = false;
    $iRecordsPerPage = 50;
    $iCounter = 0;
    $iPage = 0;
    $bEof = false;
    $iSort = "";
    $iSorted = "";
    $sDirection = "";
    $sSortParams = "";
    $iTmpI = 0;
    $iTmpJ = 0;
    $sCountSQL = "";
    $transit_params = "";
    $form_params = trim(session_name()) . "=" . trim(session_id()) . "&s_RADI_DEPE_ACTU=" . tourl(get_param("s_RADI_DEPE_ACTU")) . "&s_RADI_NOMB=" . tourl(get_param("s_RADI_NOMB")) . "&s_RADI_NUME_RADI=" . tourl(get_param("s_RADI_NUME_RADI")) . "&s_TDOC_CODI=" . tourl(get_param("s_TDOC_CODI")) . "&s_desde_dia=" . tourl(get_param("s_desde_dia")) . "&s_desde_mes=" . tourl(get_param("s_desde_mes")) . "&s_desde_ano=" . tourl(get_param("s_desde_ano")) . "&s_hasta_dia=" . tourl(get_param("s_hasta_dia")) . "&s_hasta_mes=" . tourl(get_param("s_hasta_mes")) . "&s_hasta_ano=" . tourl(get_param("s_hasta_ano")) . "&s_solo_nomb=" . tourl(get_param("s_solo_nomb")) . "&";
    //-------------------------------
    // Build ORDER BY statement
    //-------------------------------
    $sOrder = " order by R_RADI_NUME_RADI Asc";
    $iSort = get_param("FormRADICADO_Sorting");
    $iSorted = get_param("FormRADICADO_Sorted");
    if (!$iSort) {
        $form_sorting = "";
    } else {
        if ($iSort == $iSorted) {
            $form_sorting = "";
            $sDirection = " DESC";
            $sSortParams = "FormRADICADO_Sorting=" . $iSort . "&FormRADICADO_Sorted=" . $iSort . "&";
        } else {
            $form_sorting = $iSort;
            $sDirection = " ASC";
            $sSortParams = "FormRADICADO_Sorting=" . $iSort . "&FormRADICADO_Sorted=" . "&";
        }
        if ($iSort == 1) {
            $sOrder = " order by R_RADI_NUME_RADI" . $sDirection;
        }
        if ($iSort == 2) {
            $sOrder = " order by R_RADI_FECH_RADI" . $sDirection;
        }
        if ($iSort == 3) {
            $sOrder = " order by R_RADI_NOMB" . $sDirection;
        }
        if ($iSort == 4) {
            $sOrder = " order by RADI_NOMB " . $sDirection;
        }
        if ($iSort == 5) {
            $sOrder = " order by radi_path" . $sDirection;
        }
        if ($iSort == 6) {
            $sOrder = " order by RADI_NUME_IDEN" . $sDirection;
        }
        if ($iSort == 7) {
            $sOrder = " order by TDOC_DESC" . $sDirection;
        }
        if ($iSort == 8) {
            $sOrder = " order by DPTO_NOMB" . $sDirection;
        }
        if ($iSort == 9) {
            $sOrder = " order by DIASR" . $sDirection;
        }
        if ($iSort == 10) {
            $sOrder = " order by MUNI_NOMB" . $sDirection;
        }
    }
    //-------------------------------
    // Encabezados HTML de las Columnas
    //-------------------------------
    ?>
     <table width="1500" class="FormTABLE">
      <tr>
       <td class="FormHeaderTD" colspan="10"><a name="RADICADO"><font class="FormHeaderFONT"><?php 
    echo $sFormTitle;
    ?>
</font></a></td>
      </tr>
      <tr>
       <td class="ColumnTD"><font class="ColumnFONT">#</font></td>	  
       <td class="ColumnTD"><a href="<?php 
    echo $sFileName;
    ?>
?<?php 
    echo $form_params;
    ?>
FormRADICADO_Sorting=1&FormRADICADO_Sorted=<?php 
    echo $form_sorting;
    ?>
&"><font class="ColumnFONT">Radicado</font></a></td>
       <td width="55" class="ColumnTD"><a href="<?php 
    echo $sFileName;
    ?>
?<?php 
    echo $form_params;
    ?>
FormRADICADO_Sorting=2&FormRADICADO_Sorted=<?php 
    echo $form_sorting;
    ?>
&"><font class="ColumnFONT">Fecha Radicación</font></a></td>
       <td width="360" class="ColumnTD"><a href="<?php 
    echo $sFileName;
    ?>
?<?php 
    echo $form_params;
    ?>
FormRADICADO_Sorting=3&FormRADICADO_Sorted=<?php 
    echo $form_sorting;
    ?>
&"><font class="ColumnFONT">ESP</font></a></td>
       <td class="ColumnTD"><a href="<?php 
    echo $sFileName;
    ?>
?<?php 
    echo $form_params;
    ?>
FormRADICADO_Sorting=6&FormRADICADO_Sorted=<?php 
    echo $form_sorting;
    ?>
&"><font class="ColumnFONT">Nombre</font></a></td>	   
       <td class="ColumnTD"><a href="<?php 
    echo $sFileName;
    ?>
?<?php 
    echo $form_params;
    ?>
FormRADICADO_Sorting=6&FormRADICADO_Sorted=<?php 
    echo $form_sorting;
    ?>
&"><font class="ColumnFONT">Identificacion</font></a></td>
       <td width="150" class="ColumnTD"><a href="<?php 
    echo $sFileName;
    ?>
?<?php 
    echo $form_params;
    ?>
FormRADICADO_Sorting=7&FormRADICADO_Sorted=<?php 
    echo $form_sorting;
    ?>
&"><font class="ColumnFONT">Tipo Documento</font></a></td>
       <td width="150" class="ColumnTD"><a href="<?php 
    echo $sFileName;
    ?>
?<?php 
    echo $form_params;
    ?>
FormRADICADO_Sorting=4&FormRADICADO_Sorted=<?php 
    echo $form_sorting;
    ?>
&"><font class="ColumnFONT">Usuario Actual</font></a></td>
       <td class="ColumnTD"><a href="<?php 
    echo $sFileName;
    ?>
?<?php 
    echo $form_params;
    ?>
FormRADICADO_Sorting=5&FormRADICADO_Sorted=<?php 
    echo $form_sorting;
    ?>
&"><font class="ColumnFONT">Imagen</font></a></td>
	   <td width="100" class="ColumnTD"><a href="<?php 
    echo $sFileName;
    ?>
?<?php 
    echo $form_params;
    ?>
FormRADICADO_Sorting=8&FormRADICADO_Sorted=<?php 
    echo $form_sorting;
    ?>
&"><font class="ColumnFONT">Departamento</font></a></td>
	   <td width="100" class="ColumnTD"><a href="<?php 
    echo $sFileName;
    ?>
?<?php 
    echo $form_params;
    ?>
FormRADICADO_Sorting=10&FormRADICADO_Sorted=<?php 
    echo $form_sorting;
    ?>
&"><font class="ColumnFONT">Municipio</font></a></td>
  	   <td class="ColumnTD"><a href="<?php 
    echo $sFileName;
    ?>
?<?php 
    echo $form_params;
    ?>
FormRADICADO_Sorting=9&FormRADICADO_Sorted=<?php 
    echo $form_sorting;
    ?>
&"><font class="ColumnFONT">Dias Restantes</font></a></td>
      </tr>
<?php 
    //-------------------------------
    // Build WHERE statement
    //-------------------------------
    // Se crea la $ps_desde_RADI_FECH_RADI con los datos ingresados.
    //------------------------------------
    $ps_desde_RADI_FECH_RADI = Date('d/m/Y H:i:s', mktime(0, 0, 0, get_param("s_desde_mes"), get_param("s_desde_dia"), get_param("s_desde_ano")));
    if (strlen($ps_desde_RADI_FECH_RADI)) {
        $HasParam = true;
        $sWhere = $sWhere . "a.RADI_FECH_RADI>=to_date('" . $ps_desde_RADI_FECH_RADI . "','dd/mm/yyyy hh24:mi:ss')";
    }
    //-----------------------
    // Se reciben
    //-----------------------
    $ps_hasta_RADI_FECH_RADI = Date('d/m/Y H:i:s', mktime(23, 59, 59, get_param("s_hasta_mes"), get_param("s_hasta_dia"), get_param("s_hasta_ano")));
    if (strlen($ps_hasta_RADI_FECH_RADI)) {
        if ($sWhere != "") {
            $sWhere .= " and ";
        }
        $HasParam = true;
        $sWhere = $sWhere . "a.RADI_FECH_RADI<=to_date('" . $ps_hasta_RADI_FECH_RADI . "','dd/mm/yyyy hh24:mi:ss')";
    }
    /* Se recibe la dependencia actual para búsqueda */
    $ps_RADI_DEPE_ACTU = get_param("s_RADI_DEPE_ACTU");
    if (is_number($ps_RADI_DEPE_ACTU) && strlen($ps_RADI_DEPE_ACTU)) {
        $ps_RADI_DEPE_ACTU = tosql($ps_RADI_DEPE_ACTU, "Number");
    } else {
        $ps_RADI_DEPE_ACTU = "";
    }
    if (strlen($ps_RADI_DEPE_ACTU)) {
        if ($sWhere != "") {
            $sWhere .= " and ";
        }
        $HasParam = true;
        $sWhere = $sWhere . "a.RADI_DEPE_ACTU=" . $ps_RADI_DEPE_ACTU;
    }
    /* Se recibe el número del radicado para búsqueda */
    $ps_RADI_NUME_RADI = get_param("s_RADI_NUME_RADI");
    if (strlen($ps_RADI_NUME_RADI)) {
        if ($sWhere != "") {
            $sWhere .= " and ";
        }
        $HasParam = true;
        $sWhere = $sWhere . "a.RADI_NUME_RADI like " . tosql("%" . $ps_RADI_NUME_RADI . "%", "Text");
    }
    /* Se recibe el tipo de documento para la búsqueda */
    $ps_TDOC_CODI = get_param("s_TDOC_CODI");
    if (is_number($ps_TDOC_CODI) && strlen($ps_TDOC_CODI) && $ps_TDOC_CODI != "9999") {
        $ps_TDOC_CODI = tosql($ps_TDOC_CODI, "Number");
    } else {
        $ps_TDOC_CODI = "";
    }
    if (strlen($ps_TDOC_CODI)) {
        if ($sWhere != "") {
            $sWhere .= " and ";
        }
        $HasParam = true;
        $sWhere = $sWhere . "b.SGD_TPR_CODIGO=" . $ps_TDOC_CODI;
    }
    /*
    // Aca se recibe el texto para busqueda de texto. Se tokeniza y se busca por cada 
    // uno de las palabras individuales por AND. 
    // s_solo_nomb toma los siguientes valores: 
    // "Texto" - si hay que buscar en todo lado
    // "Nombre" - si hay que buscar solo en el nombre (radi_nomb antiguamente)
    // s_RADI_NOMB trae el parametro para busqueda, puede ser una cadena separada por espacios
    */
    $ps_RADI_NOMB = get_param("s_RADI_NOMB");
    $ps_solo_nomb = get_param("s_solo_nomb");
    $array_nombre = split(" ", strip(get_param("s_RADI_NOMB")) . "    ");
    $where_split = "";
    if (strip(get_param("s_RADI_NOMB"))) {
        if ($array_nombre[0]) {
            $where_split = " and CONCAT(CONCAT(d.sgd_ciu_nombre,d.sgd_ciu_apell1),d.sgd_ciu_apell2) LIKE '%" . $array_nombre[0] . "%' ";
        }
        if ($array_nombre[1]) {
            $where_split .= " and  CONCAT(CONCAT(d.sgd_ciu_nombre,d.sgd_ciu_apell1),d.sgd_ciu_apell2) LIKE '%" . $array_nombre[1] . "%' ";
        }
        if ($array_nombre[2]) {
            $where_split .= " and CONCAT(CONCAT(d.sgd_ciu_nombre,d.sgd_ciu_apell1),d.sgd_ciu_apell2) LIKE '%" . $array_nombre[2] . "%' ";
        }
        if ($array_nombre[3]) {
            $where_split .= " and CONCAT(CONCAT(d.sgd_ciu_nombre,d.sgd_ciu_apell1),d.sgd_ciu_apell2) LIKE '%" . $array_nombre[3] . "%' ";
        }
    }
    if ($HasParam) {
        $sWhere = " WHERE  a.radi_nume_radi =d.radi_nume_radi (+) and  a.tdoc_codi=b.sgd_tpr_codigo and a.tdoc_codi=b.sgd_tpr_codigo  AND (" . $sWhere . ")  {$where_split} ";
    }
    //-------------------------------
    // Build base SQL statement
    //-------------------------------
    $campos_ver = "a.RADI_NUME_HOJA\n\t   \t\t\t ,a.RADI_FECH_RADI as R_RADI_FECH_RADI\n\t\t\t\t ,a.RADI_NUME_RADI  as R_RADI_NUME_RADI\n\t\t\t\t ,a.RA_ASUN as R_RADI_ASUN\n\t\t\t\t ,a.RADI_PATH R_RADI_PATH\n\t\t\t\t ,a.RADI_USU_ANTE\n\t\t\t\t ,c.NOMBRE_DE_LA_EMPRESA as R_RADI_NOMB\n\t\t\t\t ,TO_CHAR(a.RADI_FECH_RADI,'DD/MM/YY   HH:MIam') AS FECHA\n\t\t\t\t ,b.sgd_tpr_descrip  as R_TDOC_DESC \n\t\t\t\t ,b.sgd_tpr_codigo\n\t\t\t\t ,b.sgd_tpr_termino,round(((radi_fech_radi+(b.sgd_tpr_termino * 7/5))-sysdate)) as diasr\n\t\t\t\t ,RADI_LEIDO\n\t\t\t\t ,RADI_TIPO_DERI\n\t\t\t\t ,RADI_NUME_DERI \n\t\t\t\t ,d.SGD_CIU_NOMBRE,d.SGD_CIU_APELL1,d.SGD_CIU_APELL2";
    $isql = "select \n\t   \t\t\t{$campos_ver}\n\t\t\t\tfrom radicado a,sgd_tpr_tpdcumento b,bodega_empresas c,\n\t\t\t\t( \n\t\t\t\t SELECT DISTINCT b.sgd_ciu_cedula,a.radi_nume_radi,b.sgd_ciu_nombre,b.sgd_ciu_apell1,b.sgd_ciu_apell2,b.sgd_ciu_codigo\n\t\t\t\t FROM SGD_DIR_DRECCIONES a,SGD_CIU_CIUDADANO b\n\t\t\t\t WHERE b.sgd_ciu_codigo  =a.sgd_ciu_codigo \n\t\t\t\t) d\n\t\t\t\t{$sWhere}\n\t\t\t\t and c.IDENTIFICADOR_EMPRESA  =  a.eesp_codi\n\t\t\t\t\n\t\t\t\t";
    $isql .= "union all \n\t            select a.RADI_NUME_HOJA,a.RADI_FECH_RADI,a.RADI_NUME_RADI,a.RA_ASUN,a.RADI_PATH,\n\t             a.RADI_USU_ANTE,'No tiene' AS NOMBRES,\n\t\t\t\t TO_CHAR(a.RADI_FECH_RADI,'DD/MM/YY   HH:MIam') AS FECHA,b.sgd_tpr_descrip,b.sgd_tpr_codigo,\n\t\t\t\t b.sgd_tpr_termino,round(((radi_fech_radi+(b.sgd_tpr_termino * 7/5))-sysdate)) as diasr,\n\t\t\t\t RADI_LEIDO,RADI_TIPO_DERI,RADI_NUME_DERI ,d.SGD_CIU_NOMBRE,d.SGD_CIU_APELL1,d.SGD_CIU_APELL2\n\t\t\t\tfrom radicado a,sgd_tpr_tpdcumento b ,\n\t\t\t\t( \n\t\t\t\t SELECT DISTINCT b.sgd_ciu_cedula,a.radi_nume_radi,b.SGD_CIU_NOMBRE,b.SGD_CIU_APELL1,b.SGD_CIU_APELL2,b.sgd_ciu_codigo\n\t\t\t\t FROM SGD_DIR_DRECCIONES a,SGD_CIU_CIUDADANO b\n\t\t\t\t WHERE b.sgd_ciu_codigo  =a.sgd_ciu_codigo \n\t\t\t\t) d\n\t\t\t\t{$sWhere}\n\t\t\t\tand a.eesp_codi=0 \t\t\t\t\n\t\t\t\t{$sOrder} ";
    $sSQL = $isql;
    //-------------------------------
    //-------------------------------
    // RADICADO Open Event begin
    // Busqueda por nivel
    /*
    $nivel = get_session("Nivel");
    if($sWhere != "") 
      $sWhere .= " and ";
    else 
      $sWhere = " where ";
    $sWhere = $sWhere . " R.CODI_NIVEL<=".$nivel ." AND R.RADI_USUA_ACTU=U.USUA_CODI AND R.RADI_DEPE_ACTU=U.DEPE_CODI ";
    */
    // Contador
    /*$sSQLCount = "Select count(*) as Total from radicado R, USUARIO U, departamento D,TIPO_DOCUMENTO B, MUNICIPIO M  " . $sWhere;
    */
    $sSQLCount1 = "select \n\t   \t\t\tcount(*) as TOTAL\n\t\t\t\tfrom radicado a,sgd_tpr_tpdcumento b,\n\t\t\t\tbodega_empresas c,\n\t\t\t\t( \n\t\t\t\t SELECT DISTINCT b.sgd_ciu_cedula,a.radi_nume_radi,b.sgd_ciu_nombre,b.sgd_ciu_apell1,b.sgd_ciu_apell2,b.sgd_ciu_codigo\n\t\t\t\t FROM SGD_DIR_DRECCIONES a,SGD_CIU_CIUDADANO b\n\t\t\t\t WHERE b.sgd_ciu_codigo=a.sgd_ciu_codigo\n\t\t\t\t) d\n\t\t\t\t{$sWhere} \n\t\t\t\t and c.IDENTIFICADOR_EMPRESA  =  a.eesp_codi";
    $sSQLCount2 = "select \n\t   \t\t\tcount(*) as TOTAL\n\t\t\t\tfrom radicado a,sgd_tpr_tpdcumento b,\n\t\t\t\t( \n\t\t\t\t SELECT DISTINCT b.sgd_ciu_cedula,a.radi_nume_radi,b.sgd_ciu_nombre,b.sgd_ciu_apell1,b.sgd_ciu_apell2,b.sgd_ciu_codigo\n\t\t\t\t FROM SGD_DIR_DRECCIONES a,SGD_CIU_CIUDADANO b\n\t\t\t\t WHERE b.sgd_ciu_codigo=a.sgd_ciu_codigo\n\t\t\t\t) d\n\t\t\t\t{$sWhere} \n\t\t\t\t and a.eesp_codi = 0\n\t\t\t\t";
    //  echo "$sSQLCount1<br><br>";
    //  echo "$sSQLCount2<br><br>";
    //  echo "$sSQL";
    /*
    $db->query($sSQLCount1);
    $next_record = $db->next_record();
    $fldTotal1 = $db->f("TOTAL"); 
    
    $db->query($sSQLCount2);
    $next_record = $db->next_record();
    $fldTotal2 = $db->f("TOTAL"); 
    
    $fldTotal = $fldTotal1 + $fldTotal2; 
    */
    // RADICADO Open Event end
    //-------------------------------
    //-------------------------------
    // Assemble full SQL statement
    //-------------------------------
    //-------------------------------
    // Execute SQL statement
    //-------------------------------
    $db->query($sSQL);
    $next_record = $db->next_record();
    //-------------------------------
    // Process empty recordset
    //-------------------------------
    if (!$next_record) {
        ?>
     <tr>
      <td colspan="10" class="DataTD"><font class="DataFONT">No hay resultados</font></td>
     </tr>
<?php 
        //-------------------------------
        //  The insert link.
        //-------------------------------
        ?>
    <tr>
     <td colspan="10" class="ColumnTD"><font class="ColumnFONT">
<?php 
        ?>
  </table>
<?php 
        return;
    }
    //-------------------------------
    ?>
     <!--tr>
      <td colspan="10" class="DataTD"><font class="DataFONT"><b>Total Registros Encontrados: <?php 
    echo $fldTotal;
    ?>
</b></font></td>
     </tr-->

<?php 
    //-------------------------------
    // Initialize page counter and records per page
    //-------------------------------
    $iRecordsPerPage = 20;
    $iCounter = 0;
    //-------------------------------
    //-------------------------------
    // Process page scroller
    //-------------------------------
    $iPage = get_param("FormRADICADO_Page");
    if (!strlen($iPage)) {
        $iPage = 1;
    } else {
        if ($iPage == "last") {
            $db_count = get_db_value($sCountSQL);
            $dResult = intval($db_count) / $iRecordsPerPage;
            $iPage = intval($dResult);
            if ($iPage < $dResult) {
                $iPage++;
            }
        } else {
            $iPage = intval($iPage);
        }
    }
    if (($iPage - 1) * $iRecordsPerPage != 0) {
        do {
            $iCounter++;
        } while ($iCounter < ($iPage - 1) * $iRecordsPerPage && $db->next_record());
        $next_record = $db->next_record();
    }
    $iCounter = 0;
    //-------------------------------
    //-------------------------------
    // Display grid based on recordset
    //-------------------------------.
    while ($next_record && $iCounter < $iRecordsPerPage) {
        //-------------------------------
        // Create field variables based on database fields
        //-------------------------------
        $fldRADI_FECH_RADI = $db->f("R_RADI_FECH_RADI");
        $fldRADI_NOMB = $db->f("R_RADI_NOMB");
        $fldRADI_NUME_IDEN = $db->f("R_RADI_NUME_IDEN");
        $fldRADI_NUME_RADI_URLLink = "detalle.php";
        $fldRADI_NUME_RADI_s_RADI_NUME_RADI = $db->f("R_RADI_NUME_RADI");
        $fldRADI_NUME_RADI = $db->f("R_RADI_NUME_RADI");
        $fldRADI_PRIM_APEL = $db->f("R_RADI_PRIM_APEL");
        $fldRADI_SEGU_APEL = $db->f("R_RADI_SEGU_APEL");
        $fldRADI_USUA_ACTU = $db->f("R_RADI_USUA_ACTU");
        $fldRADI_USUA_NOMBRE = $db->f("SGD_CIU_APELL1") . " " . $db->f("SGD_CIU_APELL2") . " " . $db->f("SGD_CIU_NOMBRE");
        $fldRADI_PATH = $db->f("R_RADI_PATH");
        $fldRADI_TDOC_DESC = $db->f("R_TDOC_DESC");
        $fldMUNI_NOMB = $db->f("M_MUNI_NOMB");
        $fldRADI_PATH1 = $db->f("R_RADI_PATH");
        $fldDPTO_CODI = $db->f("R_DPTO_CODI");
        $fldDPTO_NOMB = $db->f("D_DPTO_NOMB");
        $fldDIASR = $db->f("DIASR");
        $fldRADI_DEPE_ACTU = $db->f("RADI_DEPE_ACTU");
        $next_record = $db->next_record();
        //-------------------------------
        // RADICADO Show begin
        //-------------------------------
        //-------------------------------
        /* RADICADO Show Event begin
        */
        if (strlen($fldRADI_PATH)) {
            $iii = $iii + 1;
            $fldRADI_PATH = "<a href='../bodega{$fldRADI_PATH1}' target='Imagen{$iii}'>Si</a>";
        } else {
            $fldRADI_PATH = "No";
        }
        // RADICADO Show Event end
        //-------------------------------
        //-------------------------------
        // Process the HTML controls
        //-------------------------------
        ?>
      <tr>
       <td class="DataTD"><font class="DataFONT"><?php 
        echo $iCounter + 1 + ($iPage - 1) * $iRecordsPerPage;
        ?>
</td> 
       <td class="DataTD"><font class="DataFONT"> <a href="<?php 
        echo $fldRADI_NUME_RADI_URLLink;
        ?>
?s_RADI_NUME_RADI=<?php 
        echo $fldRADI_NUME_RADI_s_RADI_NUME_RADI;
        ?>
&"><font class="DataFONT"><?php 
        echo $fldRADI_NUME_RADI;
        ?>
</font></a>&nbsp;</font></td>
       <td class="DataTD"><font class="DataFONT">
      <?php 
        echo tohtml($fldRADI_FECH_RADI);
        ?>
&nbsp;</font></td>
       <td class="DataTD"><font class="DataFONT">
      <?php 
        echo tohtml($fldRADI_NOMB);
        ?>
&nbsp;</font></td>
       <td class="DataTD"><font class="DataFONT">
      <?php 
        echo tohtml($fldRADI_USUA_NOMBRE);
        ?>
&nbsp;</font></td>
       <td class="DataTD"><font class="DataFONT">
      <?php 
        echo tohtml($fldRADI_NUME_IDEN);
        ?>
&nbsp;</font></td>
       <td class="DataTD"><font class="DataFONT">
      <?php 
        echo tohtml($fldRADI_TDOC_DESC);
        ?>
&nbsp;</font></td>
       <td class="DataTD"><font class="DataFONT">
      <?php 
        echo tohtml($fldRADI_USUA_ACTU);
        ?>
&nbsp;</font></td>
       <td class="DataTD"><font class="DataFONT">
      <?php 
        echo $fldRADI_PATH;
        ?>
&nbsp;</font></td>
       <td class="DataTD"><font class="DataFONT">
      <?php 
        echo tohtml($fldDPTO_NOMB);
        ?>
&nbsp;</font></td>	  
       <td class="DataTD"><font class="DataFONT">
      <?php 
        echo tohtml($fldMUNI_NOMB);
        ?>
&nbsp;</font></td>	  
      <td class="DataTD"><font class="DataFONT">
      <?php 
        if ($fldRADI_DEPE_ACTU != 999) {
            echo tohtml($fldDIASR);
        } else {
            echo "Sal";
        }
        ?>
&nbsp;</font></td>	  
      </tr>


	  
	  <?php 
        //-------------------------------
        // RADICADO Show end
        //-------------------------------
        //-------------------------------
        // Move to the next record and increase record counter
        //-------------------------------
        $iCounter++;
    }
    //-------------------------------
    //  Grid. The insert link and record navigator.
    //-------------------------------
    ?>
    <tr>
     <td colspan="10" class="ColumnTD"><font class="ColumnFONT">
<?php 
    // RADICADO Navigation begin
    $bEof = $next_record;
    if ($bEof || $iPage != 1) {
        $iCounter = 1;
        $iHasPages = $iPage;
        $sPages = "";
        $iDisplayPages = 0;
        $iNumberOfPages = 30;
        /* El número de páginas que aparecerán en el navegador al pie de la página */
        while ($next_record && $iHasPages < $iPage + $iNumberOfPages) {
            if ($iCounter == $iRecordsPerPage) {
                $iCounter = 0;
                $iHasPages = $iHasPages + 1;
            }
            $iCounter++;
            $next_record = $db->next_record();
        }
        if (!$next_record && $iCounter > 1) {
            $iHasPages++;
        }
        if ($iHasPages - $iPage < intval($iNumberOfPages / 2)) {
            $iStartPage = $iHasPages - $iNumberOfPages;
        } else {
            $iStartPage = $iPage - $iNumberOfPages + intval($iNumberOfPages / 2);
        }
        if ($iStartPage < 0) {
            $iStartPage = 0;
        }
        for ($iPageCount = $iPageCount + 1; $iPageCount <= $iPage - 1; $iPageCount++) {
            $sPages .= "<a href=" . $sFileName . "?" . $form_params . $sSortParams . "FormRADICADO_Page=" . $iPageCount . "#RADICADO\"><font " . "class=\"ColumnFONT\"" . ">" . $iPageCount . "</font></a>&nbsp;";
            $iDisplayPages++;
        }
        $sPages .= "<font " . "class=\"ColumnFONT\"" . "><b>" . $iPage . "</b></font>&nbsp;";
        $iDisplayPages++;
        $iPageCount = $iPage + 1;
        while ($iDisplayPages < $iNumberOfPages && $iStartPage + $iDisplayPages < $iHasPages) {
            $sPages .= "<a href=\"" . $sFileName . "?" . $form_params . $sSortParams . "FormRADICADO_Page=" . $iPageCount . "#RADICADO\"><font " . "class=\"ColumnFONT\"" . ">" . $iPageCount . "</font></a>&nbsp;";
            $iDisplayPages++;
            $iPageCount++;
        }
        if ($iPage == 1) {
            ?>
        <font class="ColumnFONT">Primero</font>
        <font class="ColumnFONT">Anterior</font>
<?php 
        } else {
            ?>
        <a href="<?php 
            echo $sFileName;
            ?>
?<?php 
            echo $form_params;
            echo $sSortParams;
            ?>
FormRADICADO_Page=1#RADICADO"><font class="ColumnFONT">Primero</font></a>
        <a href="<?php 
            echo $sFileName;
            ?>
?<?php 
            echo $form_params;
            echo $sSortParams;
            ?>
FormRADICADO_Page=<?php 
            echo $iPage - 1;
            ?>
#RADICADO"><font class="ColumnFONT">Anterior</font></a>
<?php 
        }
        echo "&nbsp;[&nbsp;" . $sPages . "]&nbsp;";
        if (!$bEof) {
            ?>
        <font class="ColumnFONT">Siguiente</font>
        <font class="ColumnFONT">Ultimo</font>
<?php 
        } else {
            ?>
        <a href="<?php 
            echo $sFileName;
            ?>
?<?php 
            echo $form_params;
            echo $sSortParams;
            ?>
FormRADICADO_Page=<?php 
            echo $iPage + 1;
            ?>
#RADICADO"><font class="ColumnFONT">Siguiente</font></a>
        <a href="<?php 
            echo $sFileName;
            ?>
?<?php 
            echo $form_params;
            echo $sSortParams;
            ?>
FormRADICADO_Page=last#RADICADO"><font class="ColumnFONT">Ultimo</font></a>
<?php 
        }
    }
    //-------------------------------
    // RADICADO Navigation end
    //-------------------------------
    //-------------------------------
    // Finish form processing
    //-------------------------------
    ?>
      </font></td></tr>
    </table>
  <?php 
    //-------------------------------
    // RADICADO Close Event begin
    // RADICADO Close Event end
    //-------------------------------
}
Пример #29
0
function PRESTAMO_show_dtl()
{
    global $db;
    global $sAction;
    global $sForm;
    global $sFileName;
    global $sPRESTAMOErr;
    global $styles;
    $fldPRES_ID = "";
    $fldRADI_NUME_RADI = "";
    $fldUSUA_LOGIN_ACTU = "";
    $fldDEPE_CODI = "";
    $fldUSUA_LOGIN_PRES = "";
    $fldPRES_DESC = "";
    $fldPRES_FECH_PRES = "";
    $fldPRES_FECH_DEVO = "";
    //-------------------------------
    // PRESTAMO Show begin
    //-------------------------------
    $sFormTitle = "Detalle Préstamo";
    $sWhere = "";
    $bPK = true;
    ?>
   
   <table class="FormTABLE">
   <form method="POST" action="<?php 
    echo $sFileName;
    ?>
" name="PRESTAMO">
   <tr><td class="FormHeaderTD" colspan="2"><font class="FormHeaderFONT"><?php 
    echo $sFormTitle;
    ?>
</font></td></tr>
   <?php 
    if ($sPRESTAMOErr) {
        ?>
		<tr><td class="DataTD" colspan="2"><font class="DataFONT"><?php 
        echo $sPRESTAMOErr;
        ?>
</font></td></tr>
	 <?php 
    }
    //-------------------------------
    // Load primary key and form parameters
    //-------------------------------
    if ($sPRESTAMOErr == "") {
        $fldPRES_ID = get_param("PRES_ID");
        $pPRES_ID = get_param("PRES_ID");
    } else {
        $fldPRES_ID = strip(get_param("PRES_ID"));
        $pPRES_ID = get_param("PK_PRES_ID");
    }
    //-------------------------------
    //-------------------------------
    // Load all form fields
    //-------------------------------
    //-------------------------------
    // Build WHERE statement
    //-------------------------------
    if (!strlen($pPRES_ID)) {
        $bPK = false;
    }
    $sWhere .= "PRES_ID=" . tosql($pPRES_ID, "Number");
    //-------------------------------
    //-------------------------------
    // PRESTAMO Open Event begin
    // PRESTAMO Open Event end
    //-------------------------------
    //-------------------------------
    // Build SQL statement and execute query
    //-------------------------------
    $sSQL = "select * from PRESTAMO where " . $sWhere;
    // Execute SQL statement
    $db->conn->SetFetchMode(ADODB_FETCH_ASSOC);
    $rs = $db->query($sSQL);
    $bIsUpdateMode = $bPK && !($sAction == "insert" && $sForm == "PRESTAMO") && ($rs && !$rs->EOF);
    //-------------------------------
    //-------------------------------
    // Load all fields into variables from recordset or input parameters
    //-------------------------------
    if ($bIsUpdateMode) {
        $fldDEPE_CODI = $rs->fields["DEPE_CODI"];
        $fldPRES_DESC = $rs->fields["PRES_DESC"];
        $fldPRES_FECH_DEVO = $rs->fields["PRES_FECH_DEVO"];
        $fldPRES_FECH_PRES = $rs->fields["PRES_FECH_PRES"];
        $fldPRES_ID = $rs->fields["PRES_ID"];
        $fldRADI_NUME_RADI = $rs->fields["RADI_NUME_RADI"];
        $fldUSUA_LOGIN_ACTU = $rs->fields["USUA_LOGIN_ACTU"];
        $fldUSUA_LOGIN_PRES = $rs->fields["USUA_LOGIN_PRES"];
        //-------------------------------
        // PRESTAMO ShowEdit Event begin
        // PRESTAMO ShowEdit Event end
        //-------------------------------
    } else {
        if ($sPRESTAMOErr == "") {
            $fldPRES_ID = tohtml(get_param("PRES_ID"));
        }
        //-------------------------------
        // PRESTAMO ShowInsert Event begin
        // PRESTAMO ShowInsert Event end
        //-------------------------------
    }
    //-------------------------------
    // PRESTAMO Show Event begin
    // PRESTAMO Show Event end
    //-------------------------------
    //-------------------------------
    // Show form field
    //-------------------------------
    ?>
      <tr>
       <td class="FieldCaptionTD">
         <font class="FieldCaptionFONT">Radicado</font>
       </td>
       <td class="DataTD">
         <font class="DataFONT">
      <?php 
    echo tohtml($fldRADI_NUME_RADI);
    ?>
&nbsp;</font>
       </td>
     </tr>
      <tr>
       <td class="FieldCaptionTD">
         <font class="FieldCaptionFONT">Usuario</font>
       </td>
       <td class="DataTD">
         <font class="DataFONT">
      <?php 
    echo tohtml($fldUSUA_LOGIN_ACTU);
    ?>
&nbsp;</font>
       </td>
     </tr>
      <tr>
       <td class="FieldCaptionTD">
         <font class="FieldCaptionFONT">Dependencia</font>
       </td>
       <td class="DataTD">
         <font class="DataFONT">
      <?php 
    echo tohtml($fldDEPE_CODI);
    ?>
&nbsp;</font>
       </td>
     </tr>
      <tr>
       <td class="FieldCaptionTD">
         <font class="FieldCaptionFONT">Prestó</font>
       </td>
       <td class="DataTD">
         <font class="DataFONT">
      <?php 
    echo tohtml($fldUSUA_LOGIN_PRES);
    ?>
&nbsp;</font>
       </td>
     </tr>
      <tr>
       <td class="FieldCaptionTD">
         <font class="FieldCaptionFONT">Descripcion</font>
       </td>
       <td class="DataTD">
         <font class="DataFONT">
      <?php 
    echo tohtml($fldPRES_DESC);
    ?>
&nbsp;</font>
       </td>
     </tr>
      <tr>
       <td class="FieldCaptionTD">
         <font class="FieldCaptionFONT">Fecha de préstamo</font>
       </td>
       <td class="DataTD">
         <font class="DataFONT">
      <?php 
    echo tohtml($fldPRES_FECH_PRES);
    ?>
&nbsp;</font>
       </td>
     </tr>
      <tr>
       <td class="FieldCaptionTD">
         <font class="FieldCaptionFONT">Fecha de devolución</font>
       </td>
       <td class="DataTD">
         <font class="DataFONT">
      <?php 
    echo tohtml($fldPRES_FECH_DEVO);
    ?>
&nbsp;</font>
       </td>
     </tr>
    <tr><td colspan="2" align="right">
  <input type="submit" value="O.K." onclick="document.PRESTAMO.FormAction.value = 'cancel';">
  <input type="hidden" name="FormName" value="PRESTAMO">
  
  <input type="hidden" name="PK_PRES_ID" value="<?php 
    echo $pPRES_ID;
    ?>
">  
  <input type="hidden" name="PRES_ID" value="<?php 
    echo tohtml($fldPRES_ID);
    ?>
">
  <input type="hidden" value="cancel" name="FormAction">
  
  </td></tr>
  </form>
  </table>
<?php 
    //-------------------------------
    // PRESTAMO Close Event begin
    // PRESTAMO Close Event end
    //-------------------------------
    //-------------------------------
    // PRESTAMO Show end
    //-------------------------------
}
Пример #30
0
        // 	WHERE custom_field_id = '$id'");
        if ($used_studentbio || $used_discipline || $used_attendance) {
            $msgFormErr = _ADMIN_ROOMS_FORM_ERROR;
        } else {
            $sSQL = "DELETE FROM school_rooms WHERE school_rooms_id={$id_to_delete}";
            $db->query($sSQL);
        }
        break;
    case "add":
        $name = get_param("name");
        //Check for duplicates
        $tot = $db->get_var("SELECT count(*) FROM school_rooms WHERE school_rooms_desc='{$name}'");
        if ($tot > 0) {
            $msgFormErr = _ADMIN_CUSTOM_FIELDS_DUP;
        } else {
            $cSQL = "INSERT INTO school_rooms (school_rooms_desc) VALUES (" . tosql($name, "Text") . ")";
            $db->query($cSQL);
        }
        break;
    case "edit":
        $id = get_param("id");
        $cSQL = "SELECT school_rooms_desc FROM school_rooms WHERE school_rooms_id = '{$id}'";
        $name = $db->get_var($cSQL);
        break;
    case "update":
        $id = get_param("id");
        $name = get_param("name");
        $cSQL = "UPDATE school_rooms SET school_rooms_desc = '{$name}' WHERE school_rooms_id = '{$id}'";
        $db->query($cSQL);
        break;
}