<?php use_helper('UrlFunctions'); ?>
<?php use_helper( 'IncludePartial' ); ?>
<style>
.grid
{
    border: 1px solid #77d5f7;
    border-top-left-radius: 5px;
    border-top-right-radius: 5px;
    border-bottom-right-radius: 5px;
    border-bottom-left-radius: 5px;
}
.grid th 
{
	border-color: #77d5f7;
    background-color: #0a7db1;
    font-weight: normal;
    font-size: 11px;
    font-family: Verdana,Arial,sans-serif;
    height: 24px;
    padding: 0 2px;
}
.grid td 
{
    border-left: 0 none;
    border-right-color: #77d5f7;
    border-right-style: solid;
    border-right-width: 1px;
    border-bottom-color: #77d5f7;
    border-bottom-style: solid;
    border-bottom-width: 1px;
    padding: 0 2px;
    white-space: pre;
    height: 22px;
    /*border: 1px solid #77d5f7;*/
}
</style>
<div id="resultContent" style=""></div>
<table class="grid" cellspacing="0" cellpadding="0" border="0" align="center" width="99%" style="border-bottom: medium none;">
    <tbody>
        <tr>
            <th width="2%" align="center" nowrap>No</th>
            <th width="8%" align="center" nowrap>Nro Orden</th>
            <th width="8%" align="center" nowrap>Nro Guia</th>
            <th width="5%" align="center" nowrap>Estado</th>
            <th width="2%" align="center" nowrap>&nbsp;</th>
        </tr>
    </tbody>
    <tbody id="content_all_row">
        <?php foreach ( $a_ALM_OrdenGuiaFactura as $i_Key => $o_ALM_OrdenGuiaFacturaBN ){ ?>
        <tr class="content_row">
            <td align="center" class="row"><label class="labelData"><?=$i_Key+1?></label></td>
            <td align="center" class="row"><label class="labelData"><?=$o_ALM_OrdenGuiaFacturaBN->getIdOrdenCompra()?></label></td>
            <td align="center" class="row"><label class="labelData"><?=$o_ALM_OrdenGuiaFacturaBN->getSerieGuiaConcat()?></label></td>
            <td align="center" class="row"><label class="labelData"><?=$o_ALM_OrdenGuiaFacturaBN->getEstadoDesc()?></label></td>
            <td align="center" ><span style='cursor:pointer; margin: 0 auto;' class='ui-icon ui-icon-trash' title='Desasociar' onclick="desasociarDocumentoFactura( '<?=$o_ALM_OrdenGuiaFacturaBN->getIdConcat()?>' );"></span></td>
        <?php } ?>
    </tbody>
    <?php if( $a_ALM_OrdenGuiaFactura ){ ?>
    <tbody>
        <tr>
            <th align="center" style="border-bottom-left-radius: 5px; height: 24px; border-bottom-right-radius: 5px;" colspan="5"> &nbsp; </th>
        </tr>
    </tbody>
    <?php } ?>
</table>
<br>
<?php if( $a_ALM_OrdenGuiaFactura ){ ?>
<table cellpadding="0" cellspacing="0" border="0" width="100%">
    <tr>
        <td align="center">
            <input type="button" class="button" value="Cerrar" onclick="parent.$( '#dialog2' ).dialog( 'close' );"/>
            <div id="s_ImagenLoad" style="display: none;"><img src="<?php echo Constantes::ROOT_DIR_APP ?>web/images/progress.gif" border="0"/>&nbsp;<label class="laber req">Procesando...</label></div>
        </td>
    </tr>
</table>
<?php } ?>
<script>
desasociarDocumentoFactura = function( id_concat )
{
    x = confirm( "Esta seguro de eliminar la asociacion?" );
    if( x )
    {
        mostrarCargaImg();
        var strFormSerialize = "";
        executeAjaxJson
        ( 
            "<?php echo buildUrl( 'asoguias/saveDeAssoc', "IdConcat=" ) ?>" + id_concat, 
            strFormSerialize,
            function( o_json )
            {
                ocultarCargaImg();
                if( o_json.error )
                {
                    mostrarMensajeError( o_json.mensaje_error );
                    return false;
                }
                location.reload();
                parent.findControl();
            } 
        );
    }
}
</script>