<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/FiniqAppMasterPage.Master" CodeBehind="FinIQCustCounterPartyLimitSetup.aspx.vb" Inherits="FinIQWebApp.FinIQCustCounterPartyLimitSetup" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>

<asp:Content ID="Content3" ContentPlaceHolderID="MainContent" runat="server">
    <style type="text/css">
        .sep {
            margin-left: 12px !important;
        }

        .sep1 {
            margin-left: 28px !important;
        }
    </style>

     <script type="text/javascript">

         function AcceptNumbersandSomeChars(evt) {
             
             var varEnvent = event || evt;
             var charCode = varEnvent.which || varEnvent.keyCode;
             // b,k,m,t,l,p, B,K,M,T,L,P, .
             if (charCode == 66 || charCode == 75 || charCode == 66 || charCode == 76 || charCode == 84 || charCode == 77
                 || charCode == 80 || charCode == 108 || charCode == 112 || charCode == 46 || charCode == 98
                 || charCode == 107 || charCode == 109 || charCode == 116)
                 return true;

             if (charCode > 31 && (charCode < 48 || charCode > 57))
                 return false;

             return true;
         }

       function AcceptOnlyNumbers(evt) {
             
             var varEnvent = event || evt;
             var charCode = varEnvent.which || varEnvent.keyCode;
            
             if (charCode == 46 || charCode == 112 || charCode == 80)
                 return true;

             if (charCode > 31 && (charCode < 48 || charCode > 57))
                 return false;

             return true;
         }

    </script>


    <asp:ScriptManagerProxy ID="ScriptManagerProxy11" runat="server">
    </asp:ScriptManagerProxy>

    <asp:UpdatePanel ID="UpdatepanelMain" runat="server" UpdateMode="Conditional">
        <ContentTemplate>
            <table>
                <tr>
                    <td colspan="7">
                        <asp:UpdateProgress ID="UpdateProgress1" runat="server" AssociatedUpdatePanelID="UpdatepanelMain" DisplayAfter="0" style="float: left">
                            <ProgressTemplate>
                                <div class="divLoading">
                                    <img alt="Loading" src="../App_Resources/loading.gif" style="width:40px" />
                                    <span class="lbl">Loading...</span>
                                </div>
                            </ProgressTemplate>
                        </asp:UpdateProgress>

                    </td>

                </tr>

                <tr>
                    <td colspan="7">

                        <asp:Label ID="lblError" runat="server" Text="" CssClass="lblerror"></asp:Label>
                    </td>

                </tr>

                <tr>


                    <td style="width: 50px">
                        <asp:Label ID="lblEntity" runat="server" CssClass="lbl" Text="Entity" Width="40px"></asp:Label>
                    </td>
                    <td style="width: 100px">
                        <asp:DropDownList ID="cboEntity" Width="120px" runat="server" CssClass="ddl"></asp:DropDownList>
                    </td>
                    <td style="width: 100px">
                    <asp:Label ID="lblCounterparty" runat="server" CssClass="lbl sep">Counterparty</asp:Label>
                    </td>
                     <td style="width: 160px">
                     <asp:DropDownList ID="cboCounterparty" runat="server" AutoPostBack="true" CssClass="ddl" Width="150px"> </asp:DropDownList>
                     </td>
                    <td style="width: 130px">

                        <asp:Button ID="btnLoad" CssClass="btn sep" runat="server" Text="Load" Width="100px" />
                    </td>

                    <td style="width: 170px">
                        

                     
                        <asp:Label ID="lblRecordsPerpage" Text="Record(s) per page" runat="server" CssClass="lbl"></asp:Label>

                        <asp:TextBox ID="txtRecordsPerPage" runat="server" CssClass="txt" Width="30" MaxLength="2" AutoPostBack="true"></asp:TextBox>

                        <cc1:filteredtextboxextender id="txtrecord" runat="server" filtermode="InvalidChars" invalidchars="." targetcontrolid="txtRecordsPerPage" />
                         <asp:Button ID="btnExport" CssClass="btn sep" Style="margin-left: 12px" runat="server" Text="Export" Width="100px" Visible="false"/>

                    </td>
<%--INT1FINFXC-121 || Namita S || 09-Dec-2020 || for Counterparty Limit setup page || Start--%>
                    <td style="width: 790px">

                        <asp:Label ID="lblTotalRecords" runat="server" CssClass="lbl" Text="Total Record(s)"></asp:Label>
                        <asp:Label ID="lblTotalRecordsCnt" runat="server" CssClass="lbl"></asp:Label>
                    </td>


                </tr>


                <tr>
                    <td colspan="7">

                        <asp:GridView ID="grdLimitSetup" runat="server" CssClass="Grid" AutoGenerateColumns="false"
                            AllowPaging="True" ShowHeaderWhenEmpty="true" EmptyDataText="No data found" AllowSorting="True" ShowFooter="false" Border="1" Width="1500px">
                            <RowStyle CssClass="GridItem" />
                            <HeaderStyle CssClass="GridHeader" />
                            <FooterStyle CssClass="GridItem" />
                            <PagerStyle CssClass="GridPager" />
                            <Columns>

                                <asp:TemplateField>

                                    <EditItemTemplate>
                                        <asp:LinkButton ID="btnUpdate" runat="server" CommandName="Update" Text="Update" Width="50px" />
                                        <asp:LinkButton ID="btnCancel" runat="server" CommandName="Cancel" Text="Cancel" Width="50px" />
                                    </EditItemTemplate>
                                    <ItemStyle HorizontalAlign="Center"  Width="120px"  />
                                    <FooterStyle HorizontalAlign="Center"  Width="120px" />
                                    <ItemTemplate>

                                        <asp:LinkButton ID="btnEdit" runat="server" CommandName="Edit" Text="Edit" Width="100px" />
                                    </ItemTemplate>

                                   <%-- <FooterTemplate>
                                        <asp:LinkButton ID="btnInsert" runat="server" CommandName="Add" Text="Add" Width="100px" ValidationGroup="Insert" />
                                    </FooterTemplate>--%>

                                </asp:TemplateField> <%--0--%>

                                <asp:BoundField HeaderText="Sr. No." DataField="" ItemStyle-HorizontalAlign="Right" ItemStyle-VerticalAlign="Middle" SortExpression=""  Visible="false" ReadOnly="true"/>
                                <%-- 1--%>

                                <asp:BoundField HeaderText="FCS_CustomerID" DataField="FCSCustomerID" ItemStyle-HorizontalAlign="Right" ItemStyle-VerticalAlign="Middle" SortExpression="FCSCustomerID" Visible="false" ReadOnly="true" />
                                <%--2--%>

                                <asp:BoundField HeaderText="Counterparty ID" DataField="CustomerId" ItemStyle-HorizontalAlign="Right" ItemStyle-VerticalAlign="Middle" SortExpression="CustomerId"  ReadOnly="true" >
                                <ItemStyle Width="50px"/>
                                    <HeaderStyle  Width="50px" />
                                </asp:BoundField>
                                <%--3--%>

                                <asp:BoundField HeaderText="Counterparty Name" DataField="CustomerName" ItemStyle-HorizontalAlign="Left" ItemStyle-VerticalAlign="Middle" SortExpression="CustomerName" ReadOnly="true"  >
                                <ItemStyle Width="150px"/>
                                    <HeaderStyle  Width="150px" />
                                </asp:BoundField>
                                <%--4--%>

                                <asp:BoundField HeaderText="Counterparty AIO No" visible="false" DataField="CustomerAIONo" ItemStyle-HorizontalAlign="Right" ItemStyle-VerticalAlign="Middle" SortExpression="CustomerAIONo" ReadOnly="true">
                                <ItemStyle Width="150px"/>
                                    <HeaderStyle  Width="150px" />
                                </asp:BoundField>
                                <%--5--%>

                                <asp:BoundField HeaderText="Bank Level FX Exposure Limit %" DataField="Fx_Exposore_limit_Per" ItemStyle-HorizontalAlign="Right" ItemStyle-VerticalAlign="Middle" SortExpression="Fx_Exposore_limit_Per" Visible="false" ReadOnly="true" >
                                <ItemStyle Width="100px"/>
                                    <HeaderStyle  Width="100px" />
                                     </asp:BoundField>
                                <%--6--%>

                                <asp:BoundField HeaderText="Bank Level FX Exposure Limit Amount" DataField="Fx_Exposore_Limit_Amount" ItemStyle-HorizontalAlign="Right" ItemStyle-VerticalAlign="Middle" SortExpression="Fx_Exposore_Limit_Amount" Visible="false" ReadOnly="true"   >
                                <ItemStyle Width="100px"/>
                                    <HeaderStyle  Width="100px" />
                                     </asp:BoundField>
                                <%--7--%>

                               <%-- <asp:BoundField HeaderText="PME Limit Ccy" DataField="DerivativeCcy" ItemStyle-HorizontalAlign="Center" ItemStyle-VerticalAlign="Middle" SortExpression="DerivativeCcy"  ReadOnly="true">
                                <ItemStyle Width="120px"/>
                                    <HeaderStyle  Width="120px" Wrap="true" />
                                     </asp:BoundField>--%>
                                 <asp:TemplateField HeaderText="PME Limit Ccy" Visible="false" SortExpression="DerivativeCcy" ItemStyle-HorizontalAlign="Center" ItemStyle-Wrap="false">
                                        <ItemTemplate>
                                            <asp:Label ID="lblLimitCcy" runat="server" Width="100px" Text='<%# Eval("DerivativeCcy")%>' Visible="true"> </asp:Label>
                                        </ItemTemplate>
                                        <EditItemTemplate>
                                             <asp:Label ID="lblLimitCcy1" runat="server" Width="100px" Text='<%# Eval("DerivativeCcy")%>' Visible="false"> </asp:Label>
                                            <asp:DropDownList ID="ddlLimitCcy" runat="server" CssClass="ddl" Width="80px"></asp:DropDownList>
                                        </EditItemTemplate>
                                    </asp:TemplateField>
                                <%--8--%>
                                <asp:TemplateField HeaderText="PME Limit %" Visible="false" SortExpression="DerivativeLimitperc">
                                       <ItemStyle HorizontalAlign="right" VerticalAlign="Middle" Width="100px" />
                                      <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="100px" />

                                    <ItemTemplate>

                                        <asp:Label ID="lblPMELimitPer" runat="server" Text='<%# Eval("DerivativeLimitperc")%>' Visible="true" ToolTip='<%# Eval("DerivativeLimitperc")%>'></asp:Label>

                                    </ItemTemplate>

                                    <EditItemTemplate>
                                        <asp:TextBox ID="txtPMELimitPer" Text='<%# Eval("DerivativeLimitperc")%>' MaxLength="10" runat="server" Visible="true" Width="100px" onkeypress="return AcceptOnlyNumbers(this);"  AutoPostBack="true" OnTextChanged="txtPMELimitPer_TextChanged"></asp:TextBox>
                                    </EditItemTemplate>

                                  <%--  <FooterTemplate>
                                        <asp:TextBox ID="ftrtxtPMELimitPer" runat="server" Width="300px" MaxLength="20" />
                                    </FooterTemplate>--%>

                                </asp:TemplateField>
                                <%--9--%>
                                <asp:TemplateField HeaderText="PME Limit Amount" Visible="false" SortExpression="DerivativeLimitAmount">
                                       <ItemStyle HorizontalAlign="right" VerticalAlign="Middle" Width="130px" Wrap="true" />
                                      <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="130px" Wrap="true"  />

                                    <ItemTemplate>

                                        <asp:Label ID="lblPMELimitAccount" runat="server" Text='<%# Eval("DerivativeLimitAmount")%>' Visible="true" ToolTip='<%# Eval("DerivativeLimitAmount")%>'></asp:Label>

                                    </ItemTemplate>

                                    <EditItemTemplate>
                                        <asp:TextBox ID="txtPMELimitAccount" Text='<%# Eval("DerivativeLimitAmount")%>' MaxLength="19" runat="server" Visible="true" Width="130px" AutoPostBack="true"  onkeypress="return AcceptNumbersandSomeChars(this);" OnTextChanged="txtPMELimitAccount_TextChanged"></asp:TextBox>

                                    </EditItemTemplate>

                                 <%--   <FooterTemplate>
                                        <asp:TextBox ID="ftrtxtPMELimitAccount" runat="server" Width="300px" MaxLength="20" />
                                    </FooterTemplate>--%>


                                </asp:TemplateField>
                                <%--10--%>
                                <asp:TemplateField HeaderText="Threshold(%)" Visible="false" SortExpression="CollThresholdPercentage">
                                     <ItemStyle HorizontalAlign="right" VerticalAlign="Middle" Width="80px" />
                                      <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="80px" />
                                    <ItemTemplate>

                                        <asp:Label ID="lblThreshold" runat="server" Text='<%# Eval("CollThresholdPercentage")%>' Visible="true" ToolTip='<%# Eval("CollThresholdPercentage")%>'></asp:Label>

                                    </ItemTemplate>

                                    <EditItemTemplate>
                                        <asp:TextBox ID="txtThreshold" Text='<%# Eval("CollThresholdPercentage")%>' MaxLength="10" runat="server" Visible="true" Width="80px" onkeypress="return AcceptOnlyNumbers(this);" AutoPostBack="true" OnTextChanged="txtThreshold_TextChanged"></asp:TextBox>

                                    </EditItemTemplate>

                                  <%--  <FooterTemplate>
                                        <asp:TextBox ID="ftrtxtThreshold" runat="server" Width="300px" MaxLength="20" />
                                    </FooterTemplate>--%>

                                </asp:TemplateField>
                                <%--11--%>
                                <%--<asp:BoundField HeaderText="Settlement Ccy" DataField="SettlementCcy" ItemStyle-HorizontalAlign="Center" ItemStyle-VerticalAlign="Middle" SortExpression="SettlementCcy" ReadOnly="true">
                                    <ItemStyle Width="100px"/>
                                    <HeaderStyle  Width="100px" />
                                     </asp:BoundField>--%>
                                <asp:TemplateField HeaderText="Limit Ccy" SortExpression="SettlementCcy" ItemStyle-HorizontalAlign="Center" ItemStyle-Wrap="false" ItemStyle-Width="50px" HeaderStyle-Width="50px">
                                        <ItemTemplate>
                                            <asp:Label ID="lblSettlCcy" runat="server" Width="50px" Text='<%# Eval("SettlementCcy")%>' Visible="true"> </asp:Label>
                                        </ItemTemplate>
                                        <EditItemTemplate>
                                            <asp:Label ID="lblSettlCcy1" runat="server" Width="50px" Text='<%# Eval("SettlementCcy")%>' Visible="false"> </asp:Label>
                                            <asp:DropDownList ID="ddlSettlCcy" runat="server" CssClass="ddl" Width="80px"></asp:DropDownList>
                                        </EditItemTemplate>
                                    </asp:TemplateField>
                                <%--12--%>
                                <asp:TemplateField HeaderText="Warning %" SortExpression="SettlementLimitPerc">
                                     <ItemStyle HorizontalAlign="right" VerticalAlign="Middle" Width="90px" />
                                      <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="90px" />

                                    <ItemTemplate>

                                        <asp:Label ID="lblSettlementLimitPerc" runat="server" Text='<%# Eval("SettlementLimitPerc")%>' Visible="true" ToolTip='<%# Eval("SettlementLimitPerc")%>'></asp:Label>

                                    </ItemTemplate>

                                    <EditItemTemplate>
                                        <asp:TextBox ID="txtSettlementLimitPerc" Text='<%# Eval("SettlementLimitPerc")%>' MaxLength="10" runat="server" Visible="true" Width="90px" onkeypress="return AcceptOnlyNumbers(this);" AutoPostBack="true" OnTextChanged="txtSettlementLimitPerc_TextChanged"></asp:TextBox>


                                    </EditItemTemplate>

                                    <%--<FooterTemplate>
                                        <asp:TextBox ID="ftrtxtSettlementLimitPerc" runat="server" Width="300px" MaxLength="20" />
                                    </FooterTemplate>--%>


                                </asp:TemplateField>
                                <%--13--%>
                                <asp:TemplateField HeaderText="Limit Amount" SortExpression="SettlementLimitAmount">
                                   <ItemStyle HorizontalAlign="right" VerticalAlign="Middle" Width="150px" />
                                      <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="150px" />
                                    <ItemTemplate>

                                        <asp:Label ID="lblSettlementLimitAmount" runat="server" Text='<%# Eval("SettlementLimitAmount")%>' Visible="true" ToolTip='<%# Eval("SettlementLimitAmount")%>'></asp:Label>

                                    </ItemTemplate>

                                    <EditItemTemplate>
                                        <asp:TextBox ID="txtSettlementLimitAmount" Text='<%# Eval("SettlementLimitAmount")%>' MaxLength="19" runat="server" Visible="true" Width="150px" AutoPostBack="true" onkeypress="return AcceptNumbersandSomeChars(this);" OnTextChanged="txtSettlementLimitAmount_TextChanged"></asp:TextBox>

                                    </EditItemTemplate>

                                 <%--   <FooterTemplate>
                                        <asp:TextBox ID="ftrtxtSettlementLimitAmount" runat="server" Width="300px" MaxLength="50" />
                                    </FooterTemplate>--%>

                                </asp:TemplateField>
                                <%--14--%>

                                 <asp:BoundField HeaderText="Created At" ReadOnly="True" DataField="CreatedAt" SortExpression="CreatedAt" Visible="true" HeaderStyle-Font-Bold="true" HeaderStyle-HorizontalAlign="Center" HeaderStyle-VerticalAlign="Middle" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="150px" />
                                 <%--15--%>
                                <asp:BoundField HeaderText="Created By" ReadOnly="True" DataField="CreatedBy" SortExpression="CreatedBy" Visible="true" HeaderStyle-Font-Bold="true" HeaderStyle-HorizontalAlign="Center" HeaderStyle-VerticalAlign="Middle" ItemStyle-HorizontalAlign="Left" ItemStyle-Width="100px" />

                               
                                <asp:BoundField HeaderText="Verified YN" DataField="VerifiedYN" ItemStyle-HorizontalAlign="Center" ItemStyle-VerticalAlign="Middle" SortExpression="VerifiedYN"  Visible="false" ReadOnly="true"/>
                                 <%--17--%>
                               
                                <asp:BoundField HeaderText="Updated At" ReadOnly="True" DataField="UpdatedAt" SortExpression="UpdatedAt" Visible="true" HeaderStyle-Font-Bold="true" HeaderStyle-HorizontalAlign="Center" HeaderStyle-VerticalAlign="Middle" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="150px" />
                                <%--18--%>
                                <asp:BoundField HeaderText="Updated By" ReadOnly="True" DataField="UpdatedBy" SortExpression="UpdatedBy" Visible="true" HeaderStyle-Font-Bold="true" HeaderStyle-HorizontalAlign="Center" HeaderStyle-VerticalAlign="Middle" ItemStyle-HorizontalAlign="Left" ItemStyle-Width="100px" />
                                 <%--19--%>

                                <asp:BoundField HeaderText="Verified At" DataField="VerifiedAt" ItemStyle-HorizontalAlign="Center" ItemStyle-VerticalAlign="Middle" SortExpression="VerifiedAt" Visible="false" ReadOnly="true"/>
                                 <%--20--%>
                                <asp:BoundField HeaderText="Verified By" DataField="VerifiedBy" ItemStyle-HorizontalAlign="Left" ItemStyle-VerticalAlign="Middle" SortExpression="VerifiedBy" Visible="false" ReadOnly="true"/>
                                 <%--21--%>

                            </Columns>
                        </asp:GridView>

<%--INT1FINFXC-121 || Namita S || 09-Dec-2020 || for Counterparty Limit setup page || END--%>
                    </td>

                </tr>
            </table>



        </ContentTemplate>
        <Triggers>
            <asp:PostBackTrigger ControlID="btnExport" />
        </Triggers>
    </asp:UpdatePanel>

</asp:Content>


