<?php $b_GlobalAccess = myUser::getUser()->hasGlobalAccess(); ?>

<form action="" method="post" name="form1" id="form1">
    <table class="marco" style="background:#E3E9E2" width="99%" border="0" cellpadding="0" cellspacing="0">
        <tr>
            <td width="95%">
                <table width="100%" cellspacing="0" cellpadding="0" border="0">
                    <tr>
                        <td nowrap="nowrap">
                            <table width="100%" cellspacing="1" cellpadding="0" border="0" class="SubCabecera">
                                 <tr>
                                     <td nowrap="nowrap">
                                        <label for="ClienteNombre" class="label">Cliente :</label>
                                    </td>
                                    <td nowrap="nowrap">
                                        <input type="text" class="text" name="ClienteNombre" id="ClienteNombre">
                                    </td>
                                    <td nowrap="nowrap"><label for="Estado" class="label">Estado</label></td>
                                    <td nowrap="nowrap">
                                        <select class="combo" name="Estado" id="Estado">
                                            <option value=""> - Seleccione - </option>
                                            <?php foreach ( $a_Estados as $s_Key => $s_Values ){ ?>
                                                <option value="<?=$s_Key?>" <?php if( $s_Key == "CE" ){ echo "SELECTED"; } ?> > <?=$s_Values?> </option>
                                            <?php } ?>
                                        </select>
                                    </td>
                                    <td nowrap="nowrap" colspan="2">
                                        <label for="FechaDocumento1" class="label" style="display: inline;">Desde:</label>
                                        <input type="text" class="text" name="FechaDocumento1" id="FechaDocumento1" size="10" style="text-align:center;" value="<?php if( isset( $nota_cred ) && $nota_cred == true ){ echo '2016-07-31';}else echo date('Y-m-d')?>">
                                        <script type="text/javascript">
                                        $( "#FechaDocumento1" ).datepicker( { dateFormat: "yy-mm-dd", changeYear:true, yearRange: "-5:+0", changeMonth: true, onClose: function (){ this.focus(); } } );
                                        </script>
                                        <label for="FechaDocumento2" class="label" style="display: inline;">Hasta:</label>
                                        <input type="text" class="text" name="FechaDocumento2" id="FechaDocumento2" size="10" style="text-align:center;" value="<?=date( "Y-m-d" )?>">
                                        <script type="text/javascript">
                                        $( "#FechaDocumento2" ).datepicker( { dateFormat: "yy-mm-dd", changeYear:true, yearRange: "-5:+0", changeMonth: true, onClose: function (){ this.focus(); } } );
                                        </script>
                                    </td>
                                    
                                </tr>
                                <tr>
                                	 <td nowrap="nowrap">
                                        <label for="IdTipoDocumento" class="label">Tipo de Documento:</label>
                                    </td>
                                    <td nowrap="nowrap">
                                        
                                        <select class="combo" name="IdTipoDocumento" id="IdTipoDocumento">
                                            <option value=""> - Seleccione - </option>
                                            <?php foreach( $a_VTA_TipoDocumento  as $o_VTA_TipoDocumentoBN ){ ?>
                                            <option value="<?=$o_VTA_TipoDocumentoBN->getIdTipoDocumento()?>"> <?=$o_VTA_TipoDocumentoBN->getDescripcionLocal()?> </option>
                                            <?php } ?>
                                            <option value="OS"> ORDEN DE VENTA </option>
                                        </select>
                                    </td>
                                    
                                    <td nowrap="nowrap"><label for=Vendedor class="label">Vendedor</label></td>
                                    <td nowrap="nowrap">
                                        <select class="combo" id="Vendedor" name="Vendedor" style="width:80%;">
                                            <option value=""> - Seleccione - </option>
                                            <?php foreach ( $a_VTA_Vendedor as $o_VTA_VendedorBN ){ ?>
                                            <option value="<?=$o_VTA_VendedorBN->getCodigoVendedor()?>" <?php if(myUser::getUser()->getUserId()==$o_VTA_VendedorBN->getObjectPersona()->getIdUsuario()){ echo "SELECTED"; } ?> > <?=$o_VTA_VendedorBN->getNombreVendedor()?> </option>
                                            <?php } ?>
                                        </select>
                                    </td>
                                    
                                    <td nowrap="nowrap">
                                        <label for="TipoVenta" class="label">Tipo Venta:</label>
                                    </td>
                                    <td nowrap="nowrap">
                                        <select class="combo required" id="TipoVenta" name="TipoVenta" style="width: 50%">
                                            <option value="">  - Seleccione - </option>
                                            <option value="MER"> Mercader&iacute;a </option>
                                            <option value="TRG"> Transferencia de Bienes a T&iacute;tulo Gratuito </option>
                                        </select>
                                    </td>
                                </tr>
                                <tr>
                                    <td nowrap="nowrap">
                                        <label for="SerieNumero" class="label">Nro Comprobante:</label>
                                    </td>
                                    <td nowrap="nowrap">
                                        <?=crearCombo( array( "name"=>"DocumentoSerie", "style"=>"width:20%" ), VTA_DocumentoFN::recuperarFiltroSerie() )?>
                                        <input type="text" class="text" name="DocumentoNumeroPr" id="DocumentoNumeroPr" style="text-align:center; width: 90px;">
                                    </td>
                                    <?php if( $b_GlobalAccess ){ ?>
                                    <td nowrap="nowrap">
                                        <label for=IdAlmacenAdmin class="label">Almac&eacute;n</label>
                                    </td>
                                    <td nowrap="nowrap">
                                         <?=crearSelect( array( "IdAlmacenAdmin", "getIdAlmacen", "getDescripcionLocal" ), $a_ALM_AlmacenMast )?>
                                    </td>
                                    <?php }else{ ?>
                                    <td nowrap="nowrap">&nbsp;</td>
                                    <td nowrap="nowrap">&nbsp;</td>
                                    <?php } ?>
                                    
                                    <td nowrap="nowrap">
                                        <label for="IdFormaPago" class="label">Forma de Pago:</label>
                                    </td>
                                    <td>
                                        <?=crearCombo( array( "name"=>"IdFormaPago", "ParamId"=>"getIdFormaPago", "ParamDesc"=>"getDescripcionLocal", "style"=>"width:40%;", "onchange"=>"" ), $a_VTA_FormaPago )?>
                                        <select class="combo" 
                                                id="CondicionPago" 
                                                name="CondicionPago"
                                                style="width: 30%;"
                                                >
                                            <option value=""> - Seleccione - </option>
                                            <option value="CON"> Con Deuda </option>
                                            <option value="SIN"> Sin Deuda </option>
                                        </select>
                                    </td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                </table>
            </td>
            <td>
                <?php if( isset( $nota_cred ) && $nota_cred == true ){ ?><input type="hidden" name="siNotaCred" value="1"><?php } ?>
                <?php if( isset( $cobranza ) && $cobranza == true ){ ?><input type="hidden" name="siCobranza" value="1"><?php } ?>
                
                <input type="hidden" name="IdCompania" value="<?=$i_IdCompania?>">
                <input type="button" onclick="findControl();" value="Buscar" class="button">
            </td>
        </tr>
    </table>
</form>
<script type="text/javascript">
formaPagoConficion = function( elm )
{
    var s_Valor = elm.value;
    var a_LstCode = ["014","015","016"];
    //pr( a_LstCode );
    //pr( jQuery.inArray( s_Valor, a_LstCode ) );
    //pr( in_array( s_Valor, a_LstCode ) );
    if( in_array( s_Valor, a_LstCode ) )
    {
        $( "#CondicionPago" ).show();
    }
    else
    {
        $( "#CondicionPago" ).hide();
    }
}
</script>