<?php use_helper('UrlFunctions'); ?>
<?php use_helper('UtilFunctions'); ?>

<script>
findControl = function()
{
    concatValueStr();
}
concatValueStr = function()
{
    strFormSerialize = returnQueryStringForm();
    if(arguments[0])
    {
        strFormSerialize += '&'+arguments[0];
    }
    executeFind(strFormSerialize);
}
exportFindControl = function(action){
  strFormSerialize = returnQueryStringForm();
  executeFindExcel(strFormSerialize, action);
}
executeFindExcel = function(str,action){ 
 
  if(typeof(action) == 'undefined'){
	  url = "<?=buildUrl('hip/grid', "block=".$block)?>";
	}else{
	  switch (action){
	    case 'add': parent.objMainTab.reqBody('<?=buildUrl('hip/add')?>','001&'+str); break;
	    case 'excel': parent.objMainTab.reqBody('<?=buildUrl('pgh/excel_hip')?>','001&'+str); break;
	    case 'pdf': parent.objMainTab.reqBody('<?=buildUrl('hip/pdf')?>','001&'+str); break;	    
	  }
	  
	  return;
	}
  
  //str = str + '&block=001';
  //url = "<?//=buildUrl('bdi/grid', "block=".$block)?>";
	var myAjax  = new Ajax.Updater(
                                	"resultGrtid",
                                	url,
                                	{
                                		asynchronous:	true,
                                		method			: 'get',
                                		parameters	: str,
                                		evalScripts	: true,
                                		onLoading   : cargandoImagenSerch(),
                                		onComplete	: function(){
                                			//objMainTab.showMenu();
                                		}
                                	});
}
executeFind = function(str)
{
    url = "<?php echo buildUrl('pgh/grid', "block=006") ?>";
    cargandoImagenSerch();
    new Ajax.Updater
    (
        'resultGrid', 
        url,
        {
            method      : 'get',
            parameters  : str,
            evalScripts    : true,
            onSuccess   : function(transport, json)
            {
                
            },
            onFailure  : function(transport)
            {
                alert("Error ("+transport.status+"): "+transport.statusText);
            },
            onComplete : function(transport)
            {
                
            }
        }
    );
}
returnQueryStringForm = function ()
{
    cadenaFormulario = $('form1').serialize();
    return(cadenaFormulario);
}
cargandoImagenSerch = function()
{
    //disabledWin.setPathImage('/images/common/progress.gif');
    disabledWin.show(true,true,'resultGrid');
}

cambiarEliminadoLogico = function( i_Id )
{
    var x = confirm( "Esta seguro de Eliminar?" );
    if( x )
    {
        var url = '<?php echo buildUrl('ajax/requestPgh') ?>';
        var pars = 'block=006&sTypeRequest=cambiarEliminadoLogico&i_Id='+i_Id;
        ejecuarAjaxUpdater( url, 'elm_ResultAjax', pars );
    }
}
</script>

<table width="100%" cellspacing="0" cellpadding="0" border="0" style="margin-top: 5px; margin-bottom: 5px;">
    <tr>
        <td class="titleBody"><li>Pago de Credito con cronograma</li></td>
        <td align="right">
            &nbsp;
           	<img src="/images/common/buttons/btnExcel.gif" title="Exportar a Excel" onClick="exportFindControl('excel');" style="cursor:pointer"/>
        </td>
    </tr>
</table>
<?php
//Mercados
$o_ClienteSystemClass = new ClienteSystemClass(new TipoNegocioBean());
$a_Mercado = $o_ClienteSystemClass->LoadMercadoXRol();
?>
<form action="" method="post" name="form1" id="form1">
    <table width="100%" cellspacing="0" cellpadding="0" border="0" class="marco" style="padding-left: 10px;">
        <tr>
            <td width="25%" nowrap="nowrap">
                <table width="100%" cellspacing="1" cellpadding="0" border="0" class="SubCabecera">
                    <tr>
                        <td width="35%" nowrap="nowrap"><label class="label" for="txtMercado">Mercado</label></td>
                        <td nowrap="nowrap">
                            <select name="cboMercado" id="cboMercado" type="text" class="combo"/> 
                                <option value="" > - Seleccionar - </option>
                                <?php foreach ($a_Mercado as $iKey => $o_MercadoBean){ ?>
                                <option value="<?=$o_MercadoBean->getIdMercado()?>">
                                <?=$o_MercadoBean->getDescripcion()?>
                                </option>
                                <?php } ?> 
                            </select>
                        </td>
                    </tr>
                </table>
            </td>
            <td width="25%" nowrap="nowrap">
                <table width="100%" cellspacing="1" cellpadding="0" border="0" class="SubCabecera">
                    <tr>
                        <td width="35%" nowrap="nowrap"><label class="label" for="txtNuemroCredito">Nro Cr&eacute;dito</label></td>
                        <td nowrap="nowrap"><input type="text" name="txtNuemroCredito" id="txtNuemroCredito" class="text" /></td>
                    </tr>
                </table>
            </td>
            <td>
                <table width="100%" cellspacing="1" cellpadding="0" border="0" class="SubCabecera">
                    <tr>
                        <td width="35%" nowrap="nowrap"><label class="label" for="s_Estado">Estado</label></td>
                        <td nowrap="nowrap">
                            <select name="s_Estado" id="s_Estado" type="text" class="combo" onchange=""/> 
                                <option value="" > Seleccione </option>
                                <option value="P" > PENDIENTE </option>
                                <option value="C" > CANCELADO </option>
                            </select>
                        </td>
                    </tr>
                </table>
            </td>
            
            <td>
                <table width="100%" cellspacing="1" cellpadding="0" border="0" class="SubCabecera">
                    <tr>
                        <td width="35%" nowrap="nowrap"><label class="label" for="s_Estado">Tipo</label></td>
                        <td nowrap="nowrap">
                            <select name="s_Tipo" id="s_Tipo" type="text" class="combo" onchange=""/> 
                            	<option value="" > Seleccione </option>
                                <option value="F" > Financiero </option>
                                <option value="H" > Hipotecario </option>
                            </select>
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
        
        <tr>
            <td width="25%" nowrap="nowrap">
                <table width="100%" cellspacing="1" cellpadding="0" border="0" class="SubCabecera">
                    <tr>
                        <td width="35%" nowrap="nowrap"><label class="label" for="txtNombre">Nombres</label></td>
                        <td nowrap="nowrap">
                            <select name="cboTipoNombre" id="cboTipoNombre" type="text" class="combo" onchange=""/> 
                                <option value="AP" > - Apellido Paterno- </option>
                                <option value="AM" > - Apellido Materno- </option>
                                <option value="NO" > - Nombres- </option>
                            </select>
                            <input name="txtNombre" id="txtNombre" type="text"  size="35" class="text"/>
                        </td>
                    </tr>
                </table>
            </td>
            <td width="25%" nowrap="nowrap">
                <table width="100%" cellspacing="1" cellpadding="0" border="0" class="SubCabecera">
                    <tr>
                        <td width="35%" nowrap="nowrap"><label class="label" for="txtNcliente">Nro Cliente</label></td>
                        <td nowrap="nowrap"><input type="text" name="txtNuemroCliente" id="txtNuemroCliente" class="text" /></td>
                    </tr>
                </table>
            </td>
            <td>
                <table width="100%" cellspacing="1" cellpadding="0" border="0" class="SubCabecera">
                    <tr>
                        <td width="35%" nowrap="nowrap"><div class="field-label"><label class="label" for="txtDni">DNI</label></td>
                        <td nowrap="nowrap">
                            <input type="text" class="text" name="txtDni" id="txtDni" />
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
        
        <tr>
            <td>
                <table width="100%" cellspacing="1" cellpadding="0" border="0" class="SubCabecera">
                    <tr>
                        <td width="35%" nowrap="nowrap"><label class="label" for="s_Moneda">Moneda</label></td>
                        <td nowrap="nowrap">
                            <select id="s_Moneda" name="s_Moneda" class="combo required">
                                <!--<option value=""> - Seleccione - </option>-->
                                <option value="S"> Soles S./ </option>
                                <!--<option value="D"> Dolares $/ </option>-->
                            </select>&nbsp;<input class="button" value="Buscar" onclick="findControl();" type="button">
                        </td>
                    </tr>
                </table>
            </td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
        </tr>
        
    
    
        <tr>
            <td colspan="2"><img width="1" height="4" src="/images/common/spacer.gif"></td>
        </tr>
    </table>
</form>

<div id="resultGrid"></div>

<div style="display:none;" id="elm_ResultAjax"></div>

<script>
findControl();
</script>