コード例 #1
0
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
    //-------------------------------
}
コード例 #2
0
ファイル: busquedas.php プロジェクト: kractos26/orfeo
function PRESTADOS_show()
{
    //-------------------------------
    // Initialize variables
    //-------------------------------
    global $db;
    global $sPRESTADOSErr;
    global $sFileName;
    global $styles;
    $sWhere = "";
    $sOrder = "";
    $sSQL = "";
    $sFormTitle = "Documentos Prestados";
    $HasParam = false;
    $iRecordsPerPage = 100;
    $iCounter = 0;
    $iPage = 0;
    $bEof = false;
    $iSort = "";
    $iSorted = "";
    $sDirection = "";
    $sSortParams = "";
    $iTmpI = 0;
    $iTmpJ = 0;
    $sCountSQL = "";
    $transit_params = "";
    $form_params = "s_DEPE_CODI=" . tourl(get_param("s_DEPE_CODI")) . "&s_PRES_DESC=" . tourl(get_param("s_PRES_DESC")) . "&s_PRES_ESTADO=" . tourl(get_param("s_PRES_ESTADO")) . "&s_PRES_REQUERIMIENTO=" . tourl(get_param("s_PRES_REQUERIMIENTO")) . "&s_RADI_NUME_RADI=" . tourl(get_param("s_RADI_NUME_RADI")) . "&s_USUA_LOGIN_ACTU=" . tourl(get_param("s_USUA_LOGIN_ACTU")) . "&s_USUA_LOGIN_PRES=" . tourl(get_param("s_USUA_LOGIN_PRES")) . "&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
    //-------------------------------
    $iSort = get_param("FormPRESTADOS_Sorting");
    $iSorted = get_param("FormPRESTADOS_Sorted");
    if (!$iSort) {
        $form_sorting = "";
        $sOrder = " order by P.PRES_FECH_PEDI DESC";
    } else {
        if ($iSort == $iSorted) {
            $form_sorting = "";
            $sDirection = " DESC";
            $sSortParams = "FormPRESTADOS_Sorting=" . $iSort . "&FormPRESTADOS_Sorted=" . $iSort . "&";
        } else {
            $form_sorting = $iSort;
            $sDirection = " ASC";
            $sSortParams = "FormPRESTADOS_Sorting=" . $iSort . "&FormPRESTADOS_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.PRES_FECH_PEDI" . $sDirection;
        }
        if ($iSort == 5) {
            $sOrder = " order by P.PRES_REQUERIMIENTO" . $sDirection;
        }
        if ($iSort == 6) {
            $sOrder = " order by P.PRES_FECH_PRES" . $sDirection;
        }
        if ($iSort == 7) {
            $sOrder = " order by P.PRES_DESC" . $sDirection;
        }
        if ($iSort == 8) {
            $sOrder = " order by P.PRES_FECH_DEVO" . $sDirection;
        }
        if ($iSort == 9) {
            $sOrder = " order by P.USUA_LOGIN_PRES" . $sDirection;
        }
        if ($iSort == 10) {
            $sOrder = " order by P.PRES_ESTADO" . $sDirection;
        }
    }
    //-------------------------------
    // HTML column headers
    //-------------------------------
    ?>
     <table class="FormTABLE">
      <tr>
       <td class="FormHeaderTD" colspan="10"><a name="PRESTADOS"><font class="FormHeaderFONT"><?php 
    echo $sFormTitle;
    ?>
</font></a></td>
      </tr>
      <tr>
       <td class="ColumnTD"><a href="<?php 
    echo $sFileName;
    ?>
?<?php 
    echo $form_params;
    ?>
FormPRESTADOS_Sorting=1&FormPRESTADOS_Sorted=<?php 
    echo $form_sorting;
    ?>
&"><font class="ColumnFONT">Radicado</font></a></td>
       <td class="ColumnTD"><a href="<?php 
    echo $sFileName;
    ?>
?<?php 
    echo $form_params;
    ?>
FormPRESTADOS_Sorting=2&FormPRESTADOS_Sorted=<?php 
    echo $form_sorting;
    ?>
&"><font class="ColumnFONT">Usuario</font></a></td>
       <td class="ColumnTD"><a href="<?php 
    echo $sFileName;
    ?>
?<?php 
    echo $form_params;
    ?>
FormPRESTADOS_Sorting=3&FormPRESTADOS_Sorted=<?php 
    echo $form_sorting;
    ?>
&"><font class="ColumnFONT">Dependencia</font></a></td>
       <td class="ColumnTD"><a href="<?php 
    echo $sFileName;
    ?>
?<?php 
    echo $form_params;
    ?>
FormPRESTADOS_Sorting=4&FormPRESTADOS_Sorted=<?php 
    echo $form_sorting;
    ?>
&"><font class="ColumnFONT">Fecha de Solicitud</font></a></td>
       <td class="ColumnTD"><a href="<?php 
    echo $sFileName;
    ?>
?<?php 
    echo $form_params;
    ?>
FormPRESTADOS_Sorting=5&FormPRESTADOS_Sorted=<?php 
    echo $form_sorting;
    ?>
&"><font class="ColumnFONT">Requerimiento</font></a></td>
       <td class="ColumnTD"><a href="<?php 
    echo $sFileName;
    ?>
?<?php 
    echo $form_params;
    ?>
FormPRESTADOS_Sorting=6&FormPRESTADOS_Sorted=<?php 
    echo $form_sorting;
    ?>
&"><font class="ColumnFONT">Fecha de Pr&eacute;stamo</font></a></td>
       <td class="ColumnTD"><a href="<?php 
    echo $sFileName;
    ?>
?<?php 
    echo $form_params;
    ?>
FormPRESTADOS_Sorting=7&FormPRESTADOS_Sorted=<?php 
    echo $form_sorting;
    ?>
&"><font class="ColumnFONT">Descripci&oacute;n</font></a></td>
       <td class="ColumnTD"><a href="<?php 
    echo $sFileName;
    ?>
?<?php 
    echo $form_params;
    ?>
FormPRESTADOS_Sorting=8&FormPRESTADOS_Sorted=<?php 
    echo $form_sorting;
    ?>
&"><font class="ColumnFONT">Fecha de Devoluci&oacute;n</font></a></td>
       <td class="ColumnTD"><a href="<?php 
    echo $sFileName;
    ?>
?<?php 
    echo $form_params;
    ?>
FormPRESTADOS_Sorting=9&FormPRESTADOS_Sorted=<?php 
    echo $form_sorting;
    ?>
&"><font class="ColumnFONT">Usuario Archivo/C.Docum</font></a></td>
       <td class="ColumnTD"><a href="<?php 
    echo $sFileName;
    ?>
?<?php 
    echo $form_params;
    ?>
FormPRESTADOS_Sorting=10&FormPRESTADOS_Sorted=<?php 
    echo $form_sorting;
    ?>
&"><font class="ColumnFONT">Estado</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_desde_RADI_FECH_RADI = Date('Y-m-d 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 . "P.PRES_FECH_PEDI>=to_date('" .$ps_desde_RADI_FECH_RADI . "','dd/mm/yyyy hh24:mi:ss')";
        $sWhere = $sWhere . "P.PRES_FECH_PEDI>=" . $db->conn->DBDate($ps_desde_RADI_FECH_RADI) . " ";
    }
    //-----------------------
    // 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")));
    $ps_hasta_RADI_FECH_RADI = Date('Y-m-d H:i:s', mktime(23, 59, 59, get_param("s_hasta_mes"), get_param("s_hasta_dia") + 1, get_param("s_hasta_ano")));
    if (strlen($ps_hasta_RADI_FECH_RADI)) {
        if ($sWhere != "") {
            $sWhere .= " and ";
        }
        $HasParam = true;
        //$sWhere = $sWhere . "P.PRES_FECH_PEDI<=to_date('" . $ps_hasta_RADI_FECH_RADI . "','dd/mm/yyyy hh24:mi:ss')";
        $sWhere = $sWhere . "P.PRES_FECH_PEDI<" . $db->conn->DBDate($ps_hasta_RADI_FECH_RADI) . "  ";
    }
    //print ($ps_hasta_RADI_FECH_RADI);
    $ps_DEPE_CODI = get_param("s_DEPE_CODI");
    if (is_number($ps_DEPE_CODI) && strlen($ps_DEPE_CODI)) {
        $ps_DEPE_CODI = tosql($ps_DEPE_CODI, "Number");
    } else {
        $ps_DEPE_CODI = "";
    }
    if (strlen($ps_DEPE_CODI)) {
        if ($sWhere != "") {
            $sWhere .= " and ";
        }
        $HasParam = true;
        $sWhere = $sWhere . "P.DEPE_CODI=" . $ps_DEPE_CODI;
    }
    $ps_PRES_DESC = get_param("s_PRES_DESC");
    if (strlen($ps_PRES_DESC)) {
        if ($sWhere != "") {
            $sWhere .= " and ";
        }
        $HasParam = true;
        $sWhere = $sWhere . "P.PRES_DESC like " . tosql("%" . $ps_PRES_DESC . "%", "Text");
    }
    $ps_PRES_ESTADO = get_param("s_PRES_ESTADO");
    if (is_number($ps_PRES_ESTADO) && strlen($ps_PRES_ESTADO)) {
        $ps_PRES_ESTADO = tosql($ps_PRES_ESTADO, "Number");
    } else {
        $ps_PRES_ESTADO = "";
    }
    if (strlen($ps_PRES_ESTADO)) {
        if ($sWhere != "") {
            $sWhere .= " and ";
        }
        $HasParam = true;
        $sWhere = $sWhere . "P.PRES_ESTADO=" . $ps_PRES_ESTADO;
    }
    $ps_PRES_REQUERIMIENTO = get_param("s_PRES_REQUERIMIENTO");
    if (is_number($ps_PRES_REQUERIMIENTO) && strlen($ps_PRES_REQUERIMIENTO)) {
        $ps_PRES_REQUERIMIENTO = tosql($ps_PRES_REQUERIMIENTO, "Number");
    } else {
        $ps_PRES_REQUERIMIENTO = "";
    }
    if (strlen($ps_PRES_REQUERIMIENTO)) {
        if ($sWhere != "") {
            $sWhere .= " and ";
        }
        $HasParam = true;
        $sWhere = $sWhere . "P.PRES_REQUERIMIENTO=" . $ps_PRES_REQUERIMIENTO;
    }
    $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 = $ps_RADI_NUME_RADI;
    } else {
        $ps_RADI_NUME_RADI = "";
    }
    if (strlen($ps_RADI_NUME_RADI)) {
        if ($sWhere != "") {
            $sWhere .= " and ";
        }
        $HasParam = true;
        $sWhere = $sWhere . "P.RADI_NUME_RADI like ('%" . $ps_RADI_NUME_RADI . "%')";
    }
    $ps_USUA_LOGIN_ACTU = get_param("s_USUA_LOGIN_ACTU");
    if (strlen($ps_USUA_LOGIN_ACTU)) {
        if ($sWhere != "") {
            $sWhere .= " and ";
        }
        $HasParam = true;
        $sWhere = $sWhere . "P.USUA_LOGIN_ACTU like " . tosql("%" . $ps_USUA_LOGIN_ACTU . "%", "Text");
    }
    $ps_USUA_LOGIN_PRES = get_param("s_USUA_LOGIN_PRES");
    if (strlen($ps_USUA_LOGIN_PRES)) {
        $ps_USUA_LOGIN_PRES = strtoupper($ps_USUA_LOGIN_PRES);
        if ($sWhere != "") {
            $sWhere .= " and ";
        }
        $HasParam = true;
        $sWhere = $sWhere . "P.USUA_LOGIN_PRES like " . tosql("%" . $ps_USUA_LOGIN_PRES . "%", "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_DEVO as P_PRES_FECH_DEVO, " . "P.PRES_FECH_PEDI as P_PRES_FECH_PEDI, " . "P.PRES_FECH_PRES as P_PRES_FECH_PRES, " . "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  ";
    //-------------------------------
    //-------------------------------
    // PRESTADOS Open Event begin
    // PRESTADOS 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_REQUERIMIENTO = split(";", "1;Documento;2;Anexo");
    $aPRES_ESTADO = split(";", "1;Solicitado;2;Prestado;3;Devuelto;4;Cancelado;5:Prestamo Indefinido");
    //-------------------------------
    //-------------------------------
    // Initialize page counter and records per page
    //-------------------------------
    $iRecordsPerPage = 100;
    $iCounter = 0;
    //-------------------------------
    //-------------------------------
    // Process page scroller
    //-------------------------------
    $iPage = get_param("FormPRESTADOS_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++;
            $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_ID = $rs->fields["P_PRES_ID"];
        $fldPRES_REQUERIMIENTO = $rs->fields["P_PRES_REQUERIMIENTO"];
        $fldRADI_NUME_RADI_URLLink = "detalle.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();
        //-------------------------------
        // PRESTADOS Show begin
        //-------------------------------
        //-------------------------------
        // PRESTADOS Show Event begin
        // PRESTADOS 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($fldPRES_FECH_PEDI);
        ?>
&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">
      <?php 
        echo tohtml($fldPRES_FECH_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_DEVO);
        ?>
&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 
        $fldPRES_ESTADO = get_lov_value($fldPRES_ESTADO, $aPRES_ESTADO);
        ?>
      <?php 
        echo tohtml($fldPRES_ESTADO);
        ?>
&nbsp;</font></td>
      </tr><?php 
        //-------------------------------
        // PRESTADOS Show end
        //-------------------------------
        //-------------------------------
        // Move to the next record and increase record counter
        //-------------------------------
        $iCounter++;
    }
    // print ("<br> $iCounter");
    //-------------------------------
    //  Grid. The insert link and record navigator.
    //-------------------------------
    ?>
    <tr>
     <td colspan="10" class="ColumnTD"><font class="ColumnFONT">
<?php 
    // PRESTADOS Navigation begin
    if ($rs && !$rs->EOF || $iPage != 1) {
        $iCounter = 1;
        $iHasPages = $iPage;
        $sPages = "";
        $iDisplayPages = 0;
        $iNumberOfPages = 10;
        while ($rs && !$rs->EOF && $iHasPages < $iPage + $iNumberOfPages) {
            if ($iCounter == $iRecordsPerPage) {
                $iCounter = 0;
                $iHasPages = $iHasPages + 1;
            }
            $iCounter++;
            $rs->MoveNext();
        }
        if ($rs->EOF && $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 = $iStartPage + 1; $iPageCount <= $iPage - 1; $iPageCount++) {
            $sPages .= "<a href=\"{$sFileName}?{$form_params}{$sSortParams}{$FormPRESTADOS_Page}={$iPageCount}#PRESTADOS\"><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 . "FormPRESTADOS_Page=" . $iPageCount . "#PRESTADOS\"><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;
            ?>
FormPRESTADOS_Page=1#PRESTADOS"><font class="ColumnFONT">Primero</font></a>
        <a href="<?php 
            echo $sFileName;
            ?>
?<?php 
            echo $form_params;
            echo $sSortParams;
            ?>
FormPRESTADOS_Page=<?php 
            echo $iPage - 1;
            ?>
#PRESTADOS"><font class="ColumnFONT">Anterior</font></a>
<?php 
        }
        echo "&nbsp;[&nbsp;" . $sPages . "]&nbsp;";
        if ($rs->EOF) {
            ?>
        <font class="ColumnFONT">Siguiente</font>
        <font class="ColumnFONT">Ultimo</font>
<?php 
        } else {
            ?>
        <a href="<?php 
            echo $sFileName;
            ?>
?<?php 
            echo $form_params;
            echo $sSortParams;
            ?>
FormPRESTADOS_Page=<?php 
            echo $iPage + 1;
            ?>
#PRESTADOS"><font class="ColumnFONT">Siguiente</font></a>
        <a href="<?php 
            echo $sFileName;
            ?>
?<?php 
            echo $form_params;
            echo $sSortParams;
            ?>
FormPRESTADOS_Page=last#PRESTADOS"><font class="ColumnFONT">Ultimo</font></a>
<?php 
        }
    }
    //-------------------------------
    // PRESTADOS Navigation end
    //-------------------------------
    //-------------------------------
    // Finish form processing
    //-------------------------------
    ?>
      </font></td></tr>
    </table>
  <?php 
    //-------------------------------
    // PRESTADOS Close Event begin
    // PRESTADOS Close Event end
    //-------------------------------
}
コード例 #3
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
    //-------------------------------
}
コード例 #4
0
ファイル: renovar.php プロジェクト: kractos26/orfeo
function R_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 = "Renovar";
    $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="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 
    }
    ?>

<?php 
    //-------------------------------
    // Load primary key and form parameters
    //-------------------------------
    if ($sPRESTAMOErr == "") {
        $fldPRES_ID = get_param("PRES_ID");
        $rqd_PRES_ID = get_param("PRES_ID");
        $pPRES_ID = get_param("PRES_ID");
    } else {
        $fldPRES_ID = strip(get_param("PRES_ID"));
        $fldUSUA_LOGIN_PRES = strip(get_param("USUA_LOGIN_PRES"));
        $fldPRES_FECH_PRES = strip(get_param("PRES_FECH_PRES"));
        $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
    $db->conn->SetFetchMode(ADODB_FETCH_ASSOC);
    $rs = $db->query($sSQL);
    $db->conn->SetFetchMode(ADODB_FETCH_NUM);
    $bIsUpdateMode = $bPK && !($sAction == "insert" && $sForm == "PRESTAMO") && ($rs && !$rs->EOF);
    //-------------------------------
    //-------------------------------
    // Load lists of values
    //-------------------------------
    $aPRES_REQUERIMIENTO = split(";", "1;Documento;2;Anexo");
    $aPRES_ESTADO = split(";", "2;Prestado;4;Cancelado;5;Prestamo indefinido");
    //-------------------------------
    //-------------------------------
    // Load all fields into variables from recordset or input parameters
    //-------------------------------
    if ($bIsUpdateMode) {
        $fldDEPE_CODI = $rs->fields["DEPE_CODI"];
        $fldPRES_FECH_PEDI = $rs->fields["PRES_FECH_PEDI"];
        $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"];
        $fldPRES_FECH_VENC = $rs->fields["PRES_FECH_VENC"];
        $timestamp = strtotime($fldPRES_FECH_VENC);
        $fldPRES_FECH_RENO = Date('d/m/Y h:i', mktime(Date('h', $timestamp), Date('i', $timestamp), 0, Date('m', $timestamp), Date('d', $timestamp) + 8, Date('Y', $timestamp)));
        //-------------------------------
        // 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"];
        }
        //-------------------------------
        // PRESTAMO ShowEdit Event begin
        // PRESTAMO ShowEdit Event end
        //-------------------------------
    } else {
        if ($sPRESTAMOErr == "") {
            $fldPRES_ID = tohtml(get_param("PRES_ID"));
            $fldUSUA_LOGIN_PRES = tohtml(get_session("UserID"));
            $fldPRES_FECH_PRES = Date('d/m/Y h:i');
            $fldPRES_FECH_VENC = Date('d/m/Y h:i', mktime(Date(h), Date(i), 0, Date(m), Date(d) + 8, Date(Y)));
        }
        //-------------------------------
        // PRESTAMO ShowInsert Event begin
        // PRESTAMO ShowInsert Event end
        //-------------------------------
    }
    //-------------------------------
    // Set lookup fields
    //-------------------------------
    $fldDEPE_CODI = get_db_value("SELECT DEPE_NOMB FROM DEPENDENCIA WHERE DEPE_CODI=" . tosql($fldDEPE_CODI, "Number"));
    if ($sPRESTAMOErr == "") {
        //-------------------------------
        // PRESTAMO Show Event begin
        $fldUSUA_LOGIN_PRES = get_session("UserID");
        // 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">Login Usuario</font>
       </td>
       <td class="DataTD">
         <font class="DataFONT"><input type="hidden" name="usuario" value="<?php 
    echo $fldUSUA_LOGIN_ACTU;
    ?>
">
      <?php 
    echo tohtml($fldUSUA_LOGIN_ACTU);
    ?>
&nbsp;</font>
       </td>
     </tr>

	  <!--tr>
       <td class="FieldCaptionTD">
         <font class="FieldCaptionFONT">Contrase&nacute;a Usuario</font>
       </td>
       <td class="DataTD">
         <font class="DataFONT"><input type="password" name="contrasena" maxlength="20" size="20" ></font>
       </td>
     </tr-->
      <tr>
       <td class="FieldCaptionTD">
         <font class="FieldCaptionFONT">Dependencia Usuario</font>
       </td>
       <td class="DataTD">
         <font class="DataFONT">
      <?php 
    echo tohtml($fldDEPE_CODI);
    ?>
&nbsp;</font>
       </td>
     </tr>
      <tr>
       <td class="FieldCaptionTD">
         <font class="FieldCaptionFONT">Fecha de Pedido</font>
       </td>
       <td class="DataTD">
         <font class="DataFONT">
      <?php 
    echo tohtml($fldPRES_FECH_PEDI);
    ?>
&nbsp;</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">Usuario que Presta</font>
       </td>
       <td class="DataTD">
         <font class="DataFONT"><input type="hidden" name="USUA_LOGIN_PRES" maxlength="15" value="<?php 
    echo tohtml($fldUSUA_LOGIN_PRES);
    ?>
" size="15" ><?php 
    echo $fldUSUA_LOGIN_PRES;
    ?>
</font>
       </td>
     </tr>
      <tr>
       <td class="FieldCaptionTD">
         <font class="FieldCaptionFONT">Fecha de Pr&eacute;stamo</font>
       </td>
       <td class="DataTD">
         <font class="DataFONT"><input type="hidden" name="PRES_FECH_PRES" maxlength="20" value="<?php 
    echo tohtml($fldPRES_FECH_PRES);
    ?>
" size="20" ><?php 
    echo $fldPRES_FECH_PRES;
    ?>
</font>
       </td>
     </tr>
      <tr>
       <td class="FieldCaptionTD">
         <font class="FieldCaptionFONT">Fecha de Vencimiento Actual</font>
       </td>
       <td class="DataTD">
         <font class="DataFONT"><?php 
    echo $fldPRES_FECH_VENC;
    ?>
</font>
       </td>
     </tr>
      <tr>
       <td class="FieldCaptionTD">
         <font class="FieldCaptionFONT">Nueva Fecha de Vencimiento</font>
       </td>
       <td class="DataTD">
         <font class="DataFONT"><input type="hidden" name="PRES_FECH_VENC" maxlength="20" value="<?php 
    echo tohtml($fldPRES_FECH_RENO);
    ?>
" size="20" ><?php 
    echo $fldPRES_FECH_RENO;
    ?>
</font>
       </td>
     </tr>
      <tr>
       <td class="FieldCaptionTD">
         <font class="FieldCaptionFONT">Descripcion</font>
       </td>
       <td class="DataTD">
         <font class="DataFONT"><input type="hidden" name="PRES_DESC" maxlength="20" value="<?php 
    echo tohtml($fldPRES_DESC);
    ?>
" size="20" ><?php 
    echo tohtml($fldPRES_DESC);
    ?>
</font>
       </td>
     </tr>
      <tr>
       <td class="FieldCaptionTD">
         <font class="FieldCaptionFONT">Estado</font>
       </td>
       <td class="DataTD">
         <font class="DataFONT"><input type="hidden" name="PRES_ESTADO" maxlength="20" value="<?php 
    echo $fldPRES_ESTADO;
    ?>
" size="20" >
      <?php 
    $fldPRES_ESTADO = get_lov_value($fldPRES_ESTADO, $aPRES_ESTADO);
    ?>
      <?php 
    echo tohtml($fldPRES_ESTADO);
    ?>
&nbsp;</font>
       </td>
     </tr>
    <tr><td colspan="2" align="right">
<?php 
    if ($bIsUpdateMode) {
        ?>
  <input type="hidden" value="update" name="FormAction"/>
  <input type="submit" value="Renovar" 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="PRESTAMO">
  
  <input type="hidden" name="Rqd_PRES_ID" value="<?php 
    echo $rqd_PRES_ID;
    ?>
";>
  <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
    //-------------------------------
}