<%@ Import Namespace="Seven.Front" %>
<%@ Import Namespace="Seven.Front.Globals" %>
<%@ Import Namespace="Seven.Front.Objects" %>

<%@ Page Language="C#" MasterPageFile="Model.Master" AutoEventWireup="true" CodeBehind="TransaccionesDiarias.aspx.cs" Inherits="Seven.Front.TransaccionesDiarias" %>

<asp:Content ID="Content1" ContentPlaceHolderID="cpHeader" runat="server">

    <% try
       { %>

    <title><%=L.TIT("TransaccionesDiarias") %> [2.7]</title>

    <script type="text/javascript">

        <% /* JQ01 */%>

        <% /* Código del jqGrid para Tipos de Habitaciones */ %>

        function GetTH() {
            $.ajax({
                url: 'Servicio.svc/GetTipoHabitacionesIDCodigoJQGrid',
                data: {
                    "U": "<%=Request.Cookies[Parametros.COOKIE_USR].Value %>", "N": "<%=Request.Cookies[Parametros.COOKIE_NOM].Value %>"
                , "D": "<%=Request.Cookies[Parametros.COOKIE_DAT].Value %>", "I": "<%=Enigma.Encriptar(Request.ServerVariables["REMOTE_ADDR"]) %>"
                , "LangCode": "<%=LangCode %>"
                },
                dataType: "json",
                type: "GET",
                contentType: "application/json; charset=utf-8",
                //beforeSend: function () {
                //    $('#dlgCargando1').dialog('open');
                //},
                success: function (json) {
                    //$('#dlgCargando1').dialog('close');
                    try {
                        $("#jqgTH").jqGrid("setGridParam", { datatype: "json", loadonce: true });
                        var thegrid = $("#jqgTH")[0];
                        thegrid.addJSONData(JSON.parse(json.d));
                        $("#jqgTH").jqGrid("setGridParam", { datatype: "local", loadonce: true });
                    }
                    catch (err) {
                        $('#dlgInformation').html(json.d);
                        $('#dlgInformation').dialog('open');
                    }
                }
            });
        }

        function LoadGridTH() {

            var lselTH;
            var colMap = {};
            $("#jqgTH").jqGrid({
                datatype: 'local',
                height: 170,
                width: 200,
                colNames: ['', '<%=L.LBL("LblGENTipoHab") %>'],
                colModel: [
                            { name: 'Id', index: 'Id', hidden: true },
                            { name: 'Id', index: 'tipo_hab', width: 100 }
                ],
                onSelectRow: function (id) {
                    if (id) {

                        if (isNaN(lselTH) && !isNaN(id)) {
                            $("#jqgTH").jqGrid('delRowData', lselTH);
                        }

                        if (!isNaN(id)) {
                            var ret = jQuery("#jqgTH").jqGrid('getRowData', id);

                            $('#jqgTH').jqGrid('restoreRow', lselTH);

                            $('#IdSubElementTH').val(ret.Id);
                        }

                        $('input[name=cbFil_tipo_hab]').prop('checked', true);

                        lselTH = id;
                    }
                },
                //afterInsertRow: function (id) { },
                onCellSelect: function (id) {
                    if (id) {
                        if (!isNaN(id)) {
                            $('#jqgTH').jqGrid('restoreRow', id);
                        }
                    }
                },
                //gridComplete: function () { },
                rowNum: 99999999,
                rowTotal: 99999999,
                loadonce: true,
                mtype: "GET",
                rownumbers: false,
                rownumWidth: 40,
                gridview: true,
                sortname: 'Id',
                viewrecords: true,
                sortorder: "asc",
                ignoreCase: true,
                scrollrows: true,
                editurl: "Dummy.aspx",
                multiselect: true
            });

        }

        function RefreshGridTH() {
            $("#jqgTH").jqGrid("setGridParam", { datatype: "json", datatype: GetTH, loadonce: true });
            $("#jqgTH").trigger("reloadGrid");
            $("#jqgTH").jqGrid("setGridParam", { datatype: "local", loadonce: true });
        }

        function TransaccionesDiarias()
        {
            window.open("Informe.aspx?r=120"
                + "&m=" + $('input[name=rbModo]:checked').val()
                + "&s=" + $('#txtFecIni').val()
                + "&f=" + $('#txtFecFin').val()
                + "&fh=" + $("input[name=cbFil_hora]:checked").val() + "&vh=" + $('#txtFil_hora').val() + "&vh2=" + $('#txtFil_hora2').val()
                + "&fsf=" + $("input[name=cbFil_id_con0]:checked").val() + "&vsf=" + $('#cbServFact').val()
                + "&fss=" + $("input[name=cbFil_id_csim]:checked").val() + "&vss=" + $('#cbServicioSimple').val()
                + "&fse=" + $("input[name=cbFil_id_cfag]:checked").val() + "&vse=" + $('#cbServAgen').val()
                + "&fm=" + $("input[name=cbFil_id_mone]:checked").val() + "&vm=" + $('#cbMoneda').val()
                + "&fo=" + $("input[name=cbFil_id_operador]:checked").val() + "&vo=" + $('#cbOperador').val()
                + "&fk=" + $("input[name=cbFil_tipo_hab]:checked").val() + "&vk=" + $("#jqgTH").jqGrid('getGridParam', 'selarrrow').toString()
                + "&fi=" + $("input[name=cbFil_importes]:checked").val() + "&vi=" + $('input[name=rbImporte]:checked').val()
            , "_blank");
        }

        function EnableFilter()
        {
            var modo = parseInt($("input[name=rbModo]:checked").val());
            if (modo == 0 || modo == 3 || modo == 5)
            {
                $('#btnFiltrar').button('enable');
            }
            else
            {
                $('#btnFiltrar').button('disable');
            }

            if (modo == 0 || modo == 2)
            {
                $('#txtFecIni').datepicker('disable');
                $('#txtFecFin').datepicker('disable');
            }
            else
            {
                $('#txtFecIni').datepicker('enable');
                $('#txtFecFin').datepicker('enable');
            }
        }

    </script>

    <script type="text/javascript">

        <% /* JS_DOC */ %>

        $(document).ready(function () {

            $("#dlgEliminar").dialog({
                autoOpen: false,
                show: "fade",
                hide: "curtain",
                resizable: false,
                height: 167,
                width: 500,
                modal: true
            });

            $("#dlgInformation").dialog({
                autoOpen: false,
                show: "fade",
                hide: "curtain",
                resizable: false,
                height: 167,
                width: 500,
                modal: true
            });

            $("#dlgCargando").dialog({
                autoOpen: false,
                show: "fade",
                hide: "curtain",
                resizable: false,
                height: 100,
                width: 270,
                modal: true,
                dialogClass: 'no-close'
            });

            $("#dlgCargando2").dialog({
                autoOpen: false,
                show: "fade",
                hide: "curtain",
                resizable: false,
                height: 100,
                width: 270,
                modal: true,
                dialogClass: 'no-close'
            });

            $("#dlgCargando3").dialog({
                autoOpen: false,
                show: "fade",
                hide: "curtain",
                resizable: false,
                height: 100,
                width: 270,
                modal: true,
                dialogClass: 'no-close'
            });

            $("#dlgFiltro").dialog({
                autoOpen: false,
                show: "fade",
                hide: "curtain",
                resizable: false,
                height: 370,
                width: 500,
                modal: true
            });

            LoadGridTH();

            RefreshGridTH();

            EnableFilter();

            $("#SevenMenu").accordion("option", "active", 2);

            $('btnEliminar').attr('disabled', true);
            $('btnGuardar').attr('disabled', true);
            $('btnCancelar').attr('disabled', true);

        });
    </script>

    <% }
       catch { } %>
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="cpPrincipal" runat="server">

    <% try
       { %>

    <div id="SevenBreadcrumb" class="ui-state-default">
        <table style="width: 100%; white-space: nowrap;">
            <tr>
                <td>
                    <div class="SevenEnlaces" onclick="window.location.href='Menu.aspx#M3';" style="cursor: pointer;">
                        <table>
                            <tr>
                                <td>
                                    <img src="img/application-icon-large.png" />
                                </td>
                                <td>
                                    <%=L.LBL("LblGENMenuTactil") %>
                                </td>
                            </tr>
                        </table>
                    </div>
                </td>
                <td>&nbsp;</td>
                <td>
                    <a href="Inicio.aspx"><%=L.LBL("LblGENInicio") %></a>
                    <img src="img/arrow.png" alt="" />
                    <a href="TransaccionesDiarias.aspx"><%=L.TIT("TransaccionesDiarias") %> [2.7]</a>
                </td>
                <td style="width: 100%;"></td>
                <td>
                    <%=L.LBL("LblGENLanguage") %>
                </td>
                <td>
                    <!-- #include file="LanguageCombo.html" -->
                </td>
            </tr>
        </table>
    </div>

    <div id="SevenPrincipal">

        <div id="SevenMedio">

            <div id="SevenInterno" style="width: 350px;">

                <% /* DLG_VAR */ %>

                <div id="dlgEliminar" title="<%=L.LBL("LblGENDelete") %>" style="text-align: center; padding-top: 25px">
                    <span class="ui-icon ui-icon-alert" style="float: left; margin: 0 7px 20px 0;"></span>¿Desea eliminar este elemento?
                </div>

                <div id="dlgInformation" title="<%=L.LBL("LblGENInformation") %>" style="text-align: center; padding-top: 25px">
                </div>

                <div id="dlgCargando" title="<%=L.LBL("LblGENLoading") %>" style="text-align: center; padding-top: 25px">
                    <img src="img/cargando2.gif" alt="<%=L.LBL("LblGENLoading") %>" />
                </div>

                <div id="dlgCargando2" title="<%=L.LBL("LblGENLoading") %>" style="text-align: center; padding-top: 25px">
                    <img src="img/cargando2.gif" alt="<%=L.LBL("LblGENLoading") %>" />
                </div>

                <div id="dlgCargando3" title="<%=L.LBL("LblGENLoading") %>" style="text-align: center; padding-top: 25px">
                    <img src="img/cargando2.gif" alt="<%=L.LBL("LblGENLoading") %>" />
                </div>

                <div id="dlgFiltro" title="<%=L.LBL("LblGENFilterBy") %>" style="text-align: center; padding-top: 25px">
                    <table style="text-align: left;">
                        <tr>
                            <td>
                                <input type="checkbox" id="cbFil_hora" name="cbFil_hora" value="1" />
                            </td>
                            <td>
                                <%=L.LBL("LblGENHora") %>:
                            </td>
                            <td>
                                <input type="text" id="txtFil_hora" value="<%="00:00:00" %>" class="eligeHora" onchange="$('input[name=cbFil_hora]').prop('checked', true);" style="width: 80px;" />
                            </td>
                            <td>
                                <input type="text" id="txtFil_hora2" value="<%="23:59:59" %>" class="eligeHora" onchange="$('input[name=cbFil_hora]').prop('checked', true);" style="width: 80px;" />
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <input type="checkbox" id="cbFil_id_con0" name="cbFil_id_con0" value="1" />
                            </td>
                            <td>
                                <%=L.LBL("LblGENServFact") %>:
                            </td>
                            <td>
                                <%=cbServFact %>
                            </td>
                            <td rowspan="6">
                                <table>
                                    <tr>
                                        <td>
                                            <input type="checkbox" id="cbFil_tipo_hab" name="cbFil_tipo_hab" value="1" />
                                        </td>
                                        <td>
                                            <%=L.LBL("LblGENTipoHab") %>:
                                        </td>
                                    </tr>
                                    <tr>
                                        <td colspan="2">
                                            <input type="hidden" id="IdSubElementTH" value="0" />
                                            <table id="jqgTH"></table>
                                        </td>
                                    </tr>
                                </table>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <input type="checkbox" id="cbFil_id_csim" name="cbFil_id_csim" value="1" />
                            </td>
                            <td>
                                <%=L.LBL("LblFDKServSimpleAbbr") %>:
                            </td>
                            <td>
                                <%=cbServicioSimple %>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <input type="checkbox" id="cbFil_id_cfag" name="cbFil_id_cfag" value="1" />
                            </td>
                            <td>
                                <%=L.LBL("LblFDKServicioAgen") %>:
                            </td>
                            <td>
                                <%=cbServAgen %>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <input type="checkbox" id="cbFil_id_mone" name="cbFil_id_mone" value="1" />
                            </td>
                            <td>
                                <%=L.LBL("LblGENMoney") %>:
                            </td>
                            <td>
                                <%=cbMoneda %>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <input type="checkbox" id="cbFil_id_operador" name="cbFil_id_operador" value="1" />
                            </td>
                            <td>
                                <%=L.LBL("LblGENUser") %>:
                            </td>
                            <td>
                                <%=cbOperador %>
                            </td>
                        </tr>
                        
                        <tr>
                            <td>
                                <input type="checkbox" id="cbFil_importes" name="cbFil_importes" value="1" />
                            </td>
                            <td>
                                <%=L.LBL("LblGENImporte") %>:
                            </td>
                            <td>
                                <input type="radio" name="rbImporte" value="0" onclick="$('input[name=cbFil_importes]').prop('checked', true);" checked="checked" /><%=L.LBL("LblFDKOFCorreccion") %><br />
                                <input type="radio" name="rbImporte" value="1" onclick="$('input[name=cbFil_importes]').prop('checked', true);" /><%=L.LBL("LblGENCharge") %><br />
                                <input type="radio" name="rbImporte" value="2" onclick="$('input[name=cbFil_importes]').prop('checked', true);" /><%=L.LBL("LblGENTodo") %>
                            </td>
                        </tr>
                    </table>

                    <br />

                    <table style="width: 100%;">
                        <tr>
                            <td colspan="4">
                                <table style="width: 100%;">
                                    <tr>
                                        <td style="width: 100%;"></td>
                                        <td>
                                            <button type="button" id="btnFiltrar2" onclick="$('#dlgFiltro').dialog('close');">
                                                <table>
                                                    <tr>
                                                        <td>
                                                            <img src="img/funnel.png" alt="<%=L.LBL("LblGENFiltrar") %>" />
                                                        </td>
                                                        <td><%=L.LBL("LblGENFiltrar") %></td>
                                                    </tr>
                                                </table>
                                            </button>
                                        </td>
                                    </tr>
                                </table>
                            </td>
                        </tr>
                    </table>

                </div>

                
                <% /* HH */ %>

                <div id="HiddenHive">

                </div>

                <% /* TIT */ %>

                <table>
                    <tr>
                        <td>
                            <span class="SevenTitulo"><%=L.TIT("TransaccionesDiarias") %> [2.7]</span>
                        </td>
                        <td>&nbsp;&nbsp;&nbsp;</td>
                        <%--<td>
                            <div class="SevenEnlaces">
                                <table>
                                    <tr>
                                        <td>
                                            <input type="checkbox" id="cbEliminado" onchange="BotonDefaultV();RefreshGridV();" value="1" /> <%=L.LBL("LblGENShowDeleted") %>
                                        </td>
                                    </tr>
                                </table>
                            </div>
                        </td>
                        <td>
                            <div class="SevenEnlaces">
                                <table>
                                    <tr>
                                        <td>
                                            <a href="#" onclick="ImprimirListado();" id="A2" ><img src="img/printer.png" /> <%=L.LBL("LblGENPrint") %></a>
                                        </td>
                                    </tr>
                                </table>
                            </div>
                        </td>--%>
                        <td>
                            <div class="SevenEnlaces">
                                <table>
                                    <tr>
                                        <td>
                                            <a href="#" onclick="window.open('http://mysevenmanuales.jimdo.com/front-desk/2-7-transacciones-diarias/', '_blank');" id="A1">
                                                <img src="img/question.png" />
                                                <%=L.LBL("LblGENHelp") %></a>
                                        </td>
                                    </tr>
                                </table>
                            </div>
                        </td>
                    </tr>
                </table>

                <% 
           if (CorrectoIns)
           {    
                %>

                <p class="SevenMsgExito"><%=L.LBL("LblGENMSG_SavedData") %></p>

                <%  } %>

                <% 
           if (CorrectoMod)
           {    
                %>

                <p class="SevenMsgExito"><%=L.LBL("LblGENMSG_UpdatedData") %></p>

                <%  } %>

                <% 
           if (CorrectoEli)
           {    
                %>

                <p class="SevenMsgExito"><%=L.LBL("LblGENMSG_DeletedData") %></p>

                <%  } %>

                <% 
           if (!String.IsNullOrEmpty(ErrorMsg))
           {    
                %>

                <p class="SevenMsgError"><%=ErrorMsg %></p>

                <%  } %>

                <br />

                <table>
                    <tr>
                        <td>
                            <%=L.LBL("LblGENStart") %>:
                        </td>
                        <td>
                            <input type="text" id="txtFecIni" class="eligeFecha" value="<%=string.Format("{0:d}", fecha_hotelera.AddDays(-1)) %>" style="width: 80px;" />
                        </td>
                        <td>
                            <%=L.LBL("LblGENEnd") %>:
                        </td>
                        <td>
                            <input type="text" id="txtFecFin" class="eligeFecha" value="<%=string.Format("{0:d}", fecha_hotelera.AddDays(-1)) %>" style="width: 80px;" />
                        </td>
                    </tr>
                </table>

                <br />

                <fieldset>
                    <legend><b><%=L.LBL("LblGENTipoInforme") %></b></legend>

                    <input type="radio" name="rbModo" value="0" checked="checked" onclick="EnableFilter();" /><%=L.REP("TDTranDia") %><br />
                    <input type="radio" name="rbModo" value="1" onclick="EnableFilter();" /><%=L.REP("TDTranscript") %><br />
                    <input type="radio" name="rbModo" value="2" onclick="EnableFilter();" /><%=L.REP("TDResumenTranDia") %><br />
                    <input type="radio" name="rbModo" value="3" onclick="EnableFilter();" /><%=L.REP("TDTranHist") %><br />
                    <input type="radio" name="rbModo" value="4" onclick="EnableFilter();" /><%=L.REP("TDProdImpu") %><br />
                    <input type="radio" name="rbModo" value="5" onclick="EnableFilter();" /><%=L.REP("TDTranHistHabi") %><br />
                </fieldset>

                <br />

                <table style="width: 100%;">
                    <tr>
                        <td colspan="4">
                            <table style="width: 100%;">
                                <tr>
                                    <td style="width: 100%;"></td>
                                    <td>
                                        <button type="button" id="btnFiltrar" onclick="$('#dlgFiltro').dialog('open');">
                                            <table>
                                                <tr>
                                                    <td>
                                                        <img src="img/funnel.png" alt="<%=L.LBL("LblGENFiltrar") %>" />
                                                    </td>
                                                    <td><%=L.LBL("LblGENFiltrar") %></td>
                                                </tr>
                                            </table>
                                        </button>
                                    </td>
                                    <td>
                                        <button type="button" id="btnInforme" onclick="TransaccionesDiarias();">
                                            <table>
                                                <tr>
                                                    <td>
                                                        <img src="img/printer.png" alt="<%=L.LBL("LblGENPrint") %>" />
                                                    </td>
                                                    <td><%=L.LBL("LblGENPrint") %></td>
                                                </tr>
                                            </table>
                                        </button>
                                    </td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                </table>

            </div>

        </div>

    </div>

    <% }
       catch { } %>
</asp:Content>

