<?php
define( 'SF_ROOT_DIR', "../../" );
define( 'SF_APP',      'sys' );

require_once( SF_ROOT_DIR.DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'configGlobal.php' );


?>
<?php $dir_url = Constantes::ROOT_DIR_APP ?>
<body>
<link rel="stylesheet" type="text/css" media="screen" href="<?php echo $dir_url ?>/web/css/jquery/default/main.css" />
<link rel="stylesheet" type="text/css" media="screen" href="<?php echo $dir_url ?>/web/css/jquery/default/grid.css" />
<link rel="stylesheet" type="text/css" media="screen" href="<?php echo $dir_url ?>/web/css/jquery/default/tab.css" />
          
<script type="text/javascript" src="<?php echo $dir_url ?>/web/js/jquery/jquery-1.10.2.js"></script>
<script type="text/javascript" src="<?php echo $dir_url ?>/web/js/jquery/ui-1.10.3/jquery-ui.js"></script>

<form id="form1" name="form1" method="POST" enctype="multipart/form-data">
    <input type="hidden" name="Control" value="ok"/>
    <table cellpadding="10" cellspacing="10" border="0">
        <td>
            Ingrese Numero de Registro del Documento
        </td>
        <td>&nbsp;&nbsp;</td>
        <td>
            <input type="text" class="" name="num_docu" id="num_docu" style="text-align:center;">
        </td>
        <td>
            <table>
                <tr>
                    <td><input type="radio" id="estado_imprimir1" name="estado_imprimir" value="N"> <label class="label" for="estado_imprimir1">VOLVER A IMPRIMIR</label></td>
                </tr>
                <tr>
                    <td><input type="radio" id="estado_imprimir2" name="estado_imprimir" value="C"> <label class="label" for="estado_imprimir2">DOCUMENTO IMPRESO</label></td>
                </tr>
            </table>
        </td>
        <td>
            <input type="submit" value="ACTUALIZAR">
        </td>
    </table>
</form>
<?php
if( isset( $_POST['Control'] ) )
{
    $cn = Conexion::getConexion();

    $s_NumDocumento = $_POST['num_docu'];
    $s_Sql = "SELECT * FROM VTA_Documento WHERE NumeroDocumento='$s_NumDocumento';";
    $o_SQLResult = mysql_query( $s_Sql, $cn->getResource() );
    if( mysql_num_rows( $o_SQLResult ) > 0 )
    {
        if( isset( $_POST['estado_imprimir'] ) )
        {
            $s_EstadoImp = $_POST['estado_imprimir'];
            $s_Sql = "UPDATE VTA_Documento SET ImpresionPendienteFlag='$s_EstadoImp' WHERE NumeroDocumento='$s_NumDocumento';";
            $o_RS = mysql_query( $s_Sql, $cn->getResource() );
            pr( "Se actualizo el Documento, ahora busque el en la grilla la opcion que selecciono." );
        }
        else
        {
            pr( "Tiene que seleccionar el Estado del Documento." );
        }
    }
    else
    {
        pr( "No se encontro el documento con el Id[$s_NumDocumento]" );
    }
}