<%@ Page Title="" Language="C#" MasterPageFile="~/Site1.Master" AutoEventWireup="true" MaintainScrollPositionOnPostback="true"
    CodeBehind="Journal.aspx.cs" Inherits="HRMS.Journal" %>

<%@ Register Assembly="Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
    Namespace="Microsoft.Reporting.WebForms" TagPrefix="rsweb" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <asp:ScriptManager ID="scriptManager" runat="server" EnablePageMethods="true">
    </asp:ScriptManager>
    <asp:UpdatePanel runat="server" ID="upMain" UpdateMode="Conditional" ChildrenAsTriggers="true">
        <ContentTemplate>
            <div class="main-panel">
                <div class="row">
                    <div class="col-md-12">
                        <section class="panel">

                         <header class="panel-heading">
                            Journal Voucher
                         </header>

                    <div class="panel-body">
                        <div class="span6">
                                <div id="divmessage" runat="server" visible="false" class="alert alert-info alert-dismissable">
                                    <asp:label text="" ID="lbl_msg" CssClass="msg" runat="server"></asp:label>
                                   
                                </div>
                            </div>

                            <div class="span6">
                                <div id="diverrmessage" runat="server" visible="false" class="alert alert-info alert-dismissable">
                                    <asp:label text="" id="lbl_err_msg" CssClass="msg" runat="server"></asp:label>
                                    
                                </div>
                            </div>

                         
                            <div class="row">
                            <label class="col-md-1 control-label">Voucher.No</label>
                                <div class="col-md-2">
                                    <asp:TextBox CssClass="form-control" Enabled= "false" ID="txt_control_total" runat="server"></asp:TextBox>
                                </div>

                            <asp:HiddenField ID="hid_journal" runat="server" />
                            <asp:HiddenField ID="hid_lbl" runat="server" />
                            <asp:HiddenField ID="hid_post" runat="server" />
                            <asp:HiddenField ID="hid_fr_cur" runat="server" />
                            <asp:HiddenField ID="hid_payroll" runat="server" />
                            <asp:HiddenField ID="hid_pr_set_id" runat="server" />
                                <label class="col-md-1 control-label">Journal</label>
                                <div class="col-md-3">
                                    <asp:TextBox CssClass="form-control" ID="txt_journal" runat="server"></asp:TextBox>
                                    <asp:RequiredFieldValidator SetFocusOnError="true" ValidationGroup="save" runat="server" id="req_journal" controltovalidate="txt_journal" errormessage="Journal Name Required!" />
                                   
                                </div>

                           <%--     <asp:DropDownList ID="myselect" runat="server" CssClass="select2">
           
        </asp:DropDownList>--%>


                                  <label class="col-md-1 control-label">Ledger</label>
                                <div class="col-md-2">
                                    <asp:DropDownList ID="ddl_ledger" runat="server" CssClass="form-control" OnSelectedIndexChanged="ddl_ledger_SelectedIndexChanged" AutoPostBack="true"></asp:DropDownList>
                                        <asp:RequiredFieldValidator SetFocusOnError="true"  ValidationGroup="save" runat="server" id="req_ddl_ledger" controltovalidate="ddl_ledger" errormessage="Ledger Name Required!" />
                                </div>
                            </div>

                             <div class="row">
                             <label class="col-md-1 control-label">Period</label>
                                <div class="col-md-2">

                                <asp:DropDownList ID="ddl_periods" Visible="false" runat="server" CssClass="form-control select2"></asp:DropDownList>

                                 <div class="input-group">
                                        <asp:HiddenField ID="hid_per" runat="server" />
                                        <asp:HiddenField ID="hid_date" runat="server" />
                                        <asp:TextBox CssClass="form-control" ID="txt_period" Enabled="false" runat="server"></asp:TextBox>
                                          <span class="input-group-btn">
                                            <button id="btn_lov_per" type="button" runat="server" class="btn btn-white" onserverclick="btn_lov_per_Click"><i class="fa fa-search"></i></button>
                                            <%--<asp:Button ID="btn_lov_per" Text="Save" CssClass="btn btn-info" runat="server" onclick="btn_lov_per_Click" />--%>
                                          </span>
                                          
                                    </div>
                                    <asp:RequiredFieldValidator SetFocusOnError="true" ValidationGroup="save" runat="server" id="RequiredFieldValidator1" controltovalidate="txt_period" errormessage="Period Name Required!" />
                                </div>

                                <label class="col-md-2 control-label">Transaction Date</label>
                                <div class="col-md-2">
                                    <asp:TextBox CssClass="form_datetime form-control" ID="txt_effective_date" AutoPostBack="true" OnTextChanged="txt_effective_date_TextChanged" runat="server"></asp:TextBox>
                                     <asp:RegularExpressionValidator ID="regexpName" runat="server"     
                                ErrorMessage="Date format is invalid please Enter (dd-MM-yyyy)." 
                                ControlToValidate="txt_effective_date" ValidationGroup="save"   
                                ValidationExpression="(0[1-9]|[12][0-9]|3[01])[-](0[1-9]|1[012])[-]\d{4}" />

                                <asp:RequiredFieldValidator SetFocusOnError="true" ValidationGroup="save" runat="server" id="RequiredFieldValidator2" controltovalidate="txt_effective_date" errormessage="Transaction Date Required!" />
                                </div>

                                <label id="lbl_cur" class="col-md-1 control-label" runat="server">Currency</label>
                                    <div class="col-md-2">
                                       <asp:TextBox CssClass="form-control" ID="txt_currency" runat="server" Enabled="false"></asp:TextBox>
                                    </div>
                                
                                


                                
                            </div>

                       
                            <div class="row">

                              <label class="col-md-1 control-label">Category</label>
                                <div class="col-md-2">
                                    <asp:TextBox CssClass="form-control select2" Visible="false" ID="txt_category" runat="server"></asp:TextBox>
                                    <asp:DropDownList ID="ddl_cat" runat="server" CssClass="form-control select2"></asp:DropDownList>
                                </div>

                                <label class="col-md-2 control-label">Document Number</label>
                                <div class="col-md-2">
                                    <asp:TextBox CssClass="form-control" ID="txt_doc_no" runat="server"></asp:TextBox>
                                </div>
                               
                             
                                 
                                   <label class="col-md-1 control-label">Source</label>
                                <div class="col-md-2">
                                    <asp:TextBox CssClass="form-control" Visible="false" ID="txt_balancetype" runat="server"></asp:TextBox>
                                    <asp:DropDownList ID="ddl_source" runat="server" CssClass="form-control" AutoPostBack="true" OnSelectedIndexChanged="ddl_source_SelectedIndexChanged"></asp:DropDownList>
                                </div>


                                  


                            </div>
                            
                             <div class="row">
                                <label class="col-md-1 control-label">Tax</label>
                                <div class="col-md-2">
                                   <asp:TextBox ID="txt_tax" CssClass="form-control"  runat="server"></asp:TextBox>
                                </div>

                                <label class="col-md-2 control-label">Clearing Company</label>
                                <div class="col-md-2">
                                    <asp:TextBox CssClass="form-control" ID="txt_clearing_company" runat="server"></asp:TextBox>
                                </div>

                               <label class="col-md-1 control-label">Description</label>
                                <div class="col-md-4">
                                    <asp:TextBox CssClass="form-control" ID="txt_desc" runat="server"></asp:TextBox>
                                    <asp:RequiredFieldValidator SetFocusOnError="true" ValidationGroup="save" runat="server" id="req_desc" controltovalidate="txt_desc" errormessage="Description Required!" />
                                    

                                </div>
                            </div>


                              

                              <div class="row" id="curr" style="display:none" runat= "server">
                              <hr />
                                <label class="col-md-1 control-label">Currency</label>
                                <div class="col-md-2">
                                        <asp:DropDownList ID="ddl_curr" runat="server" CssClass="form-control" AutoPostBack= "true" OnSelectedIndexChanged="ddl_curr_SelectedIndexChanged"></asp:DropDownList>
                                </div>

                               
                               
                                
                                <label class="col-md-1 control-label">Type</label>
                                <div class="col-md-2">
                                    <%--<asp:TextBox CssClass="form-control" ID="txt_type" runat="server" Enabled="false"></asp:TextBox>--%>
                                    <asp:DropDownList ID="ddl_type" runat="server" CssClass="form-control" onchange="return DateEnable()"></asp:DropDownList>
                                </div>

                                <label class="col-md-1 control-label">Date</label>
                                <div class="col-md-2">
                                    <asp:TextBox CssClass="form-control form_datetime" ID="txt_date" runat="server" OnTextChanged="txt_date_TextChanged" AutoPostBack="true"></asp:TextBox>
                                </div>

                                 

                                <label class="col-md-1 control-label">Rate</label>
                                <div class="col-md-2">
                                    <asp:TextBox CssClass="form-control" ID="txt_rate"  style="text-align:right" runat="server" Enabled="false"></asp:TextBox>
                                    </div>
                                </div>


                                <div class="pull-right" style="padding-top:10px" id="div_chng_cur" runat="server">
                                    <div class="col-md-2">
                                        <button id="btn_chng_curr"  type="button" runat="server" class="btn btn-white" onclick="return textBox_Visible()">Change Currency</button>      
                                    </div>
                                </div>


                                <div class="pull-right" style="padding-top:10px;display:none;" id="div_rst_cur" runat="server">
                                    <div class="col-md-2">
                                        <button id="btn_reset_curr"  type="button" runat="server" class="btn btn-white" onserverclick="btn_reset_curr_Click">Default Currency</button>      
                                    </div>
                                   
                                </div>



                              <ul class="nav nav-tabs" style="padding-top:10px">
                                  <li><a data-toggle="tab" href="#conversion" aria-controls="conversion" runat="server">Conversion</a></li>
                                   <li class="active"><a data-toggle="tab" href="#line" aria-controls="line" runat="server">Line</a></li>
                              </ul>


                            <div class="tab-content">
                            <div id="conversion" class="tab-pane fade">
                               <hr />

                                 <label class="control-label">Reverse</label>
                               <hr />
                             <div class="row">
                            
                                <label class="col-md-1 control-label">Date</label>
                                <div class="col-md-2">
                                    <asp:TextBox CssClass="form-control form_datetime" ID="txt_curr_conversion_date" runat="server"></asp:TextBox>
                                </div>

                                <label class="col-md-1 control-label">Period</label>
                                <div class="col-md-2">
                                    <asp:TextBox CssClass="form-control" ID="txt_dtl_period" runat="server"></asp:TextBox>
                                </div>

                                 <label class="col-md-1 control-label">Method</label>
                                <div class="col-md-2">
                                    <asp:TextBox CssClass="form-control" ID="txt_method" runat="server"></asp:TextBox>
                                </div>

                                <label class="col-md-1  control-label">Status</label>
                                <div class="col-md-2">
                                    <asp:TextBox CssClass="form-control" ID="txt_status" runat="server"></asp:TextBox>
                                </div>
                            </div>
                            </div>

                        

                            
                            <div class="pull-right">
                                <asp:Button runat="server" ID="btn_detail" CssClass="btn btn-info" 
                                    Text="Add Detail" onclick="btn_detail_Click" Visible="false"/>
                            </div>


                        

                             <div class="tab-pane fade in active" id="line">
                             <div class="pull-right">
                                <asp:Button runat="server" ID="btn_save_dtl" CssClass="btn btn-info" Visible="false" 
                                     Text="Save Detail" onclick="btn_save_dtl_Click" CommandName="btn_save"/>
                            </div>
                           
                             <div style="width: 102%; height:250px; overflow: scroll">
                                    <asp:GridView ID="GridView1" runat="server" CellPadding="0" Border="0" GridLines="Horizontal"
                                        AutoGenerateColumns="False" onrowdatabound="GridView1_RowDataBound" CssClass="table table-striped table-bordered table-hover"
                                        onrowcommand="GridView1_RowCommand" onrowdeleting="GridView1_RowDeleting" >
                                        <Columns>
                                            <asp:TemplateField HeaderText="Account" ControlStyle-Width="225px" ItemStyle-Width="80px">
                                               <ItemTemplate>
                                               <asp:HiddenField ID="hid_ldgr" runat="server" Value='<%#Bind("LEDGER_ID") %>' />
                                               <asp:HiddenField ID="hid_comb" runat="server" Value='<%#Bind("CODE_COMBINATION_ID") %>' />
                                                  
                                               <%-- <asp:HiddenField ID="lbl_id" runat="server" Value='<%#Bind("JE_LINE_NUM") %>' />--%>
                                               <asp:Label ID="lbl_id" runat="server" Visible="false" Text='<%#Bind("JE_LINE_NUM") %>'></asp:Label>
                                                    <div class="input-group">
                                                        <asp:HiddenField ID="hid_acc" runat="server" />
                                                        <asp:HiddenField ID="hid_acc_desc" runat="server" />
                                                        <asp:HiddenField ID="hf_desc" Value='<%#Bind("desc") %>' runat="server"/>
                                                            <asp:TextBox ID="txt_acc" Enabled="false" runat="server" CssClass="form-control" Text='<%#Bind("account_id") %>'></asp:TextBox>
                                                                <span class="input-group-btn">
                                                                    <button id="btn_lov" type="button" runat="server" class="btn btn-white" onserverclick="btn_lov_Click"><i class="fa fa-search"></i></button>

                                                                     <asp:HiddenField ID="hf_row" Value='<%# Container.DataItemIndex %>' runat="server" />
                                                                    <button id="btn_addcc" type="button" onclick="PopupCombination('<%# row_id.ClientID  %>','<%# ((GridViewRow)Container).FindControl("hf_row").ClientID %>')"class="btn btn-white">
                                                                        <i class="fa fa-plus"></i>
                                                                    </button>


                                                                    <button id="btn_desc" type="button" visible="false" runat="server" class="btn btn-white" onserverclick="btn_desc_Click"><i class="fa fa-info"></i></button>
                                                                    <button id="btn_cc" type="button" onclick="ShowDesc('<%# txt_acc_desc.ClientID  %>','<%# ((GridViewRow)Container).FindControl("hf_desc").ClientID %>')"class="btn btn-white">
                                                                        <i class="fa fa-info"></i>
                                                                    </button>
                                                                </span>

                                                         
                                                    </div>
                                                </ItemTemplate>
                                            </asp:TemplateField>

                                            <asp:TemplateField ControlStyle-Width="150px" ItemStyle-Width="20px">
                                                <HeaderTemplate>
                                                    <asp:Label ID="dbt" runat="server"></asp:Label>
                                                </HeaderTemplate>

                                                <ItemTemplate>
                                                    <asp:TextBox ID="txt_debit" style="text-align:right" Width="150px"  CssClass="form-control col-md-1"  runat="server" onkeypress="return numbersOnly(event)"  AutoPostBack="true" OnTextChanged="txt_debit_TextChanged"   Text='<%#Bind("ACCOUNTED_DR") %>'></asp:TextBox>
                                                </ItemTemplate>
                                            </asp:TemplateField>

                                             <asp:TemplateField ControlStyle-Width="150px" ItemStyle-Width="20px">
                                                 <HeaderTemplate>
                                                    <asp:Label ID="crdt" runat="server"></asp:Label>
                                                </HeaderTemplate>

                                                <ItemTemplate>
                                                    <asp:TextBox ID="txt_credit" style="text-align:right"  Width="150px" CssClass="form-control col-md-1" onkeypress="return numbersOnly(event)" OnTextChanged="txt_credit_TextChanged" runat="server" Text='<%#Bind("ACCOUNTED_CR") %>' AutoPostBack="true"></asp:TextBox>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            
                                             <asp:TemplateField HeaderText="Description" ControlStyle-Width="350px" ItemStyle-Width="150px">
                                                <ItemTemplate>
                                                       <%--<asp:Label ID="lbl_a_desc" CssClass="control-label"  runat="server" Text='<%#Bind("desc")%>'></asp:Label>--%>
                                                    <asp:TextBox ID="txt_a_desc" CssClass="form-control"  runat="server" Text='<%#Bind("des") %>'></asp:TextBox>
                                                    <asp:RequiredFieldValidator SetFocusOnError="true" ValidationGroup='<%# "add_"+Container.DataItemIndex %>' runat="server" id="desc" controltovalidate="txt_a_desc" errormessage="Description is Required!" />
                                                </ItemTemplate>
                                            </asp:TemplateField>

                                            <%--<asp:TemplateField HeaderText="Description">
                                                <ItemTemplate>
                                                    <asp:TextBox ID="txt_desc" CssClass="form-control col-md-2" runat="server"  Text='<%#Bind("DESCRIPTION") %>'></asp:TextBox>
                                                </ItemTemplate>
                                            </asp:TemplateField>--%>

                                            <asp:TemplateField HeaderText="Action" ItemStyle-Width="40px">
                                                <ItemTemplate>
                                                    <asp:LinkButton ID="lnk" CommandName="g_add" runat="server" ValidationGroup='<%# "add_"+Container.DataItemIndex %>'><i class="fa fa-plus" style="font-size:20px !important"></i></asp:LinkButton>
                                                    &nbsp;
                                                    <asp:LinkButton ID="lnk_dlt"  CommandName="g_dlt" runat="server" OnClick="lnk_dlt_Click"><i class="fa fa-remove" style="font-size:20px !important"></i></asp:LinkButton>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                        </Columns>
                                    </asp:GridView>
                                    </div>

                                    <div class="row">
                                    <div class="col-md-1" style="margin-left:350px">
                                        <%--<asp:Label ID="txt_dr"  CssClass="control-label" runat="server"></asp:Label>--%>
                                        <asp:TextBox ID="txt_dr" runat="server" style="border: none;background-color:transparent" Enabled="false"></asp:TextBox>
                                    </div>

                                    <div class="col-md-1" style="margin-left:50px">
                                   <%-- <asp:Label ID="txt_cr" CssClass="control-label" Text="" runat="server"></asp:Label>--%>
                                    
                                        <asp:TextBox ID="txt_cr" runat="server" style="border: none;background-color:transparent"  Enabled="false"></asp:TextBox>
                                    </div>

                                    <div class="col-md-4 col-md-offset-1">
                                    <asp:CompareValidator ID="cmp_dr" Operator="Equal" runat="server" ValidationGroup="save"
                                        ControlToValidate="txt_cr" ControlToCompare="txt_dr" ErrorMessage="Credit Value Must be equal to Debit Value"></asp:CompareValidator>
                                    </div>
                                      
                                    </div>
                                   
                                    <div class="row">
                                <label class="control-label col-md-2">Account Description</label>
                                <div class="col-md-8">
                                    <asp:TextBox ID="txt_acc_desc" Enabled="false" runat="server" CssClass="form-control"></asp:TextBox>
                                </div>
                            </div>
                            </div>
                            
                           <%-- <hr />
                            <div class="row">
                                <label class="col-md-2 control-label" runat="server">Account Description</label>
                                <div class="col-md-8">
                                    <asp:TextBox ID="txt_acc_desc" runat="server" CssClass="form-control"></asp:TextBox>
                                </div>
                            </div>--%>
                    </div>


                    <div class="row" style="padding-top:10px;margin-left:15px">
                        <asp:Button ID="btn_save" Text="Save" CssClass="btn btn-primary" Width="200px" runat="server" ValidationGroup="save" onclick="btn_save_Click" />
                    <asp:Button ID="btn_post" Text="Post" Visible="false" CssClass="btn btn-primary" Width="170px" runat="server"  onclick="btn_post_Click" />
                            <asp:Button ID="btn_cancel" Text="Back" CssClass="btn btn-primary"  Width="200px"
                                runat="server" onclick="btn_cancel_Click" />

                                <asp:Button ID="btn_roll_bck" Text="Roll Back" CssClass="btn btn-danger"  Width="200px"
                                runat="server" onclick="btn_roll_bck_Click" Enabled="false" OnClientClick="return confirm('Are you sure you want to Rollback this Transaction?')"/>
                                     <%--<input type="button" id="btn_clr" runat="server" value="Clear" class="btn btn-primary" style="width:200px" onclick="clearTextBox()" />--%>
                                     <asp:Button ID="btn_cl" Text="Add New" CssClass="btn btn-primary" Width="200px" runat="server" OnClick="btn_cl_Click"/>
                                     <asp:Button ID="btn_prnt" Text="Print" CssClass="btn btn-primary" Width="200px" 
                                runat="server" onclick="btn_prnt_Click"/>
                                </div>
                     <asp:Repeater ID="add_info" runat="server" Visible="false">
                            <HeaderTemplate><header class="panel-heading">Additional Information</header><br /></HeaderTemplate>
                            <ItemTemplate>
                                <div class="row">
                                    <asp:Label ID="r_lbl" CssClass="control-label col-md-2" runat="server" Text='<%#Eval("PROMPT") %>'></asp:Label>
                                    <div class="col-md-3">
                                        <asp:TextBox ID="txt_r_value" runat="server" CssClass="form-control" Text='<%#Eval("value") %>' placeholder='<%#Eval("PROMPT") %>'></asp:TextBox>
                                        <asp:HiddenField ID="hid_field_name" runat="server" Value='<%#Eval("col_name") %>' />
                                    </div>
                                </div>
                            </ItemTemplate>
                        </asp:Repeater>
                </section>
                    </div>
                </div>
            </div>
            <script type="text/javascript">
                // Material Select Initialization
                $(document).ready(function () {
                    $('.mdb-select').materialSelect();
                });
            </script>

            <%--Clear All Textbox--%>
            <script type="text/javascript">
                function clearTextBox() {
                    var elements = document.getElementsByTagName("input");
                    for (var ii = 0; ii < elements.length; ii++) {
                        if (elements[ii].type == "text") {
                            elements[ii].value = "";
                        }
                    }
                    document.getElementById('<%=hid_journal.ClientID %>').value = "";
                    document.getElementById('<%=hid_per.ClientID %>').value = "";
                    document.getElementById('<%=ddl_ledger.ClientID %>').value = "";
                }
            </script>
            <%--Textbox Visible--%>
            <script type="text/javascript">
                function textBox_Visible() {
                    var div_a = document.getElementById('<%=curr.ClientID %>');
                    var div_chng = document.getElementById('<%=div_chng_cur.ClientID %>');
                    var div_reset = document.getElementById('<%=div_rst_cur.ClientID %>');
                    var lbl_cur = document.getElementById('<%=lbl_cur.ClientID %>');
                    var txt_cur = document.getElementById('<%=txt_currency.ClientID %>');

                    if (div_a.style.display == "none") {
                        div_a.style.display = "block";
                        div_chng.style.display = "none";
                        div_reset.style.display = "block";
                        lbl_cur.style.display = "none";
                        txt_cur.style.display = "none";
                    }
                    return false;
                }
            </script>
            <%--Function Use in Button Reset Currency/Default Currency--%>
            <script type="text/javascript">
                function textBox_hide() {
                    var div_a = document.getElementById('<%=curr.ClientID %>');
                    var div_chng = document.getElementById('<%=div_chng_cur.ClientID %>');
                    var div_reset = document.getElementById('<%=div_rst_cur.ClientID %>');
                    var lbl_cur = document.getElementById('<%=lbl_cur.ClientID %>');
                    var txt_cur = document.getElementById('<%=txt_currency.ClientID %>');

                    if (div_reset.style.display != "none") {
                        div_a.style.display = "none";
                        div_chng.style.display = "block";
                        div_reset.style.display = "none";
                        lbl_cur.style.display = "block";
                        txt_cur.style.display = "block";

                        document.getElementById('<%=txt_rate.ClientID %>').value = "";
                        document.getElementById('<%=txt_date.ClientID %>').value = "";
                        document.getElementById('<%=ddl_type.ClientID %>').selectedIndex = "0";
                        document.getElementById('<%=ddl_curr.ClientID %>').selectedIndex = "0";
                    }
                    return false;
                }
            </script>
            <%--DateTextbox Enable in selected index of dropdown type--%>
            <script type="text/javascript">
                function DateEnable() {
                    var ddl_type = document.getElementById("<%=ddl_type.ClientID %>");
                    var date = document.getElementById("<%=txt_date.ClientID %>");
                    if (ddl_type.selectedIndex > 0) {
                        document.getElementById("<%=txt_date.ClientID %>").disabled = false;
                    }
                    else if (ddl_type.selectedIndex == 0) {
                        document.getElementById("<%=txt_date.ClientID %>").disabled = true;
                        date.value = "";
                    }
                    return false;
                }
            </script>



            <script type="text/javascript">

                function ShowDesc(clientid, clid2) {

                    $('#' + '' + clientid).val($('#' + '' + clid2).val());
                }
            </script>


                       
                    </div>



        </ContentTemplate>
        <Triggers>
            <%--<asp:AsyncPostBackTrigger ControlID="ddl_ledger" EventName="SelectedIndexChanged" />--%>
            <asp:AsyncPostBackTrigger ControlID="btn_save" EventName="Click" />
        </Triggers>
    </asp:UpdatePanel>


    
              <div class="modal fade" id="CostVal" role="dialog">
                               <div class="modal-dialog modal-dialog-center" >
                                <div class="modal-content">
                                  <div class="modal-header">
                                    <button type="button" class="close" data-dismiss="modal">&times;</button>
                                    <h4 class="modal-title">Costing Values :</h4>
                                     
                                  </div>
                                  <div class="modal-body">
                                       <asp:HiddenField ID="row_id" runat="server" />
                                        <asp:Repeater ID="rpt_cost" runat="server" OnItemDataBound="rpt_cost_OnItemDataBound">
                                          <ItemTemplate>
                                            <div class="form-group">
                                              <div class="col-lg-1"></div>
                                                <asp:Label ID="r_lbl" runat="server" class="col-lg-3 col-sm-3 control-label" Text='<%# Eval("PROMPT") %>'></asp:Label>
                                                <div class="col-lg-6">
                                                     <asp:DropDownList Width="320px" ID="ddl_r_value" runat="server" CssClass="form-control select2"></asp:DropDownList>
                                                     <asp:HiddenField ID="hid_field_name" runat="server" Value='<%# Eval("col_name") %>' ></asp:HiddenField>
                                                     <asp:HiddenField ID="hid_vs_name" runat="server" Value='<%# Eval("SEG_VALUE_SET") %>' ></asp:HiddenField>
                                                     <asp:HiddenField ID="hid_value" runat="server" Value='<%# Eval("VALUE") %>' ></asp:HiddenField>

                                                </div>
                                            </div>
                                            
                                           </ItemTemplate>  
                                       </asp:Repeater>
                                  </div>
                                 
                                  <div class="modal-footer">
                                  <asp:Button ID="btn_rpt_load" runat="server" CssClass="btn btn-default" Text="Save & Close" OnClick="btn_rpt_load_Click"></asp:Button>
                                  </div>
                                </div>
                               </div>
                            </div>
                           

                         <script type="text/javascript">

                             function PopupCombination(clientid, clid2) {

                                 $('#' + '' + clientid).val($('#' + '' + clid2).val());
                                 $('#CostVal').modal();
                             }
                         </script>

      <script src="../../ThemeScrips/jquery.min.js"></script>
    <link href="../../ThemeScrips/select2.min.css"
        rel="stylesheet" />
    <script src="../../ThemeScrips/select2.min.js"></script>
    <%--<script src="/ThemeScrips/select2.min.js"></script>--%>
    <script>
        $('.select2').select2();
    </script>
</asp:Content>
