<%@ Page Title="" Language="C#" MasterPageFile="~/masterpage/MasterPage.master" AutoEventWireup="true" CodeFile="DSCommission.aspx.cs" Inherits="MasterAdmin_DSCommission" %>


<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">

<script language="javascript" type="text/javascript">
        function fixedlength(textboxID, keyEvent, maxlength) {
            //validation for digits upto 'maxlength' defined by caller function
            if (textboxID.value.length > maxlength) {
                textboxID.value = textboxID.value.substr(0, maxlength);
            }
            else if (textboxID.value.length < maxlength || textboxID.value.length == maxlength) {
                textboxID.value = textboxID.value.replace(/[^\d]+/g, '');
                return true;
            }
            else
                return false;
        }

        function numericFilter(txb) {
            txb.value = txb.value.replace(/[^\0-9]/ig, "");
        }
 </script>
 <script type="text/javascript" language="javascript">
     function DisableRightClick(event) {

         //For mouse right click

         if (event.button == 2) {

             alert("Right Clicking not allowed!");

         }

     }

     function DisableCtrlKey(e) {

         var code = (document.all) ? event.keyCode : e.which;

         var message = "Ctrl key functionality is disabled!";

         // look for CTRL key press

         if (parseInt(code) == 17) {

             //alert(message);

             window.event.returnValue = false;

         }

     }

    </script>

</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">


    <div id="request">
        

        <table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
        
            <tr><td colspan="4" class="hdr"></td></tr>
            
            <tr>
                        <td width="25%">
                            &nbsp;
                        </td>
                        <td width="14%" style="text-align:right">
                            Select Distributor
                        </td>
                        <td width="4%" style="text-align:center">
                            <strong>:</strong>
                        </td>
                        <td width="54%">
                            <asp:DropDownList ID="ddlDistributor" runat="server" Width="225px" 
                                AutoPostBack="true" 
                                onselectedindexchanged="ddlDistributor_SelectedIndexChanged">
                            </asp:DropDownList>
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ErrorMessage="Please Select Distributor" ControlToValidate="ddlDistributor"
                                 InitialValue="111111111" SetFocusOnError="true" ValidationGroup="sub" ></asp:RequiredFieldValidator>
                        </td>
                    </tr>

            <tr>
                        <td width="25%">
                            &nbsp;
                        </td>
                        <td width="14%" style="text-align:right">
                            Select Service
                        </td>
                        <td width="4%" style="text-align:center">
                            <strong>:</strong>
                        </td>
                        <td width="54%">
                            <asp:DropDownList ID="DropDownList3" runat="server" Width="225px" 
                                AutoPostBack="true" 
                                onselectedindexchanged="DropDownList3_SelectedIndexChanged">
                                <asp:ListItem Value="0">Select Type</asp:ListItem>
                                <asp:ListItem Value="1">Recharge</asp:ListItem>
                                <asp:ListItem Value="2">Bill Payment</asp:ListItem>
                                <asp:ListItem Value="4">Money Transfer</asp:ListItem>
                                 <asp:ListItem Value="5">Flight</asp:ListItem>
                                <asp:ListItem Value="3">Other</asp:ListItem>
                            </asp:DropDownList>
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="Please Select Service" ControlToValidate="DropDownList3"
                                 InitialValue="0" ValidationGroup="sub" SetFocusOnError="true" ></asp:RequiredFieldValidator>
                        </td>
                    </tr>
            <tr>
                <td style="height: 30px" colspan="4">
                    
                </td>
            </tr>
            
            
            <tr>
                <td colspan="7">
                    
                    <asp:GridView ID="GVWlRechargeComm" runat="server" AutoGenerateColumns="false" 
                        GridLines="None"  Width="100%" HorizontalAlign="Center" ShowFooter="True" DataKeyNames="MobileDthOperatorID">
                        <FooterStyle BackColor="#dddee0" Font-Bold="True" ForeColor="Black" />
                        <PagerStyle BackColor="#dddee0" ForeColor="White" HorizontalAlign="Center" />
                        <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                        <HeaderStyle BackColor="#dddee0" Font-Bold="True" ForeColor="Black" />
                        <EditRowStyle BackColor="#2461BF" />
                        <AlternatingRowStyle BackColor="White" />
                        <Columns>
                                    <asp:TemplateField ItemStyle-Width="10%">
                                        <ItemTemplate >
                                            <asp:CheckBox ID="chkbox" runat="server" />
                                            <%#Container.DataItemIndex + 1 %>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="Operator" ItemStyle-Width="20%">
                                        <ItemTemplate>
                                            <asp:Label ID="lblOperator" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.OperatorName") %>'></asp:Label>
                                        </ItemTemplate>
                                    </asp:TemplateField>                                    
                                    <asp:BoundField HeaderText="Service" DataField="OperatorType" ItemStyle-Width="20%"/>                                    
                                    <asp:TemplateField HeaderText="My Margin" ItemStyle-Width="15%">
                                        <ItemTemplate>
                                            <asp:Label ID="lblWlCommission" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.WlCommInPercentag") %>'></asp:Label>%
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    
                                    <asp:TemplateField HeaderText="DSMargin(in%)" ItemStyle-Width="20%">
                                        <ItemTemplate>
                                            <asp:TextBox ID="DsCommission" Width="95px" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.CommINPer") %>'
                                                onKeyUp="numericFilter(this);" oncopy="return false"  onpaste="return false" oncut="return false" onmousedown="DisableRightClick(event)" onkeydown="return DisableCtrlKey(event)" autocomplete="off"></asp:TextBox>%
                                        </ItemTemplate>
                                    </asp:TemplateField>  
                                     <asp:TemplateField HeaderText="AgentMargin(in%)" ItemStyle-Width="15%">
                                        <ItemTemplate>
                                            <asp:TextBox ID="AgentRechargeCommission" Width="95px" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.UserCommINPer") %>'
                                                onKeyUp="numericFilter(this);" oncopy="return false"  onpaste="return false" oncut="return false" onmousedown="DisableRightClick(event)" onkeydown="return DisableCtrlKey(event)" autocomplete="off"></asp:TextBox>%
                                        </ItemTemplate>
                                    </asp:TemplateField> 
                                </Columns>
                        <EditRowStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                        <AlternatingRowStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                    </asp:GridView>
                    
                    <asp:GridView ID="GVWlBillPayComm" runat="server" AutoGenerateColumns="false" 
                        GridLines="None"  Width="100%" HorizontalAlign="Center" ShowFooter="True" 
                        DataKeyNames="MobileDthOperatorID,WlCommInPercentag,WlSerCharInPercentag,WlSerChaInRS" 
                        onrowdatabound="GVWlBillPayComm_RowDataBound">
                        <FooterStyle BackColor="#dddee0" Font-Bold="True" ForeColor="Black" />
                        <PagerStyle BackColor="#dddee0" ForeColor="White" HorizontalAlign="Center" />
                        <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                        <HeaderStyle BackColor="#dddee0" Font-Bold="True" ForeColor="Black" />
                        <EditRowStyle BackColor="#2461BF" />
                        <AlternatingRowStyle BackColor="White" />
                        <Columns>
                                    <asp:TemplateField>
                                        <ItemTemplate >
                                            <asp:CheckBox ID="chkbox" runat="server" />
                                            <%#Container.DataItemIndex+1 %>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="Operator" ItemStyle-Width="120">
                                        <ItemTemplate>
                                            <asp:Label ID="lblOperator" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.OperatorName") %>'></asp:Label>
                                        </ItemTemplate>
                                    </asp:TemplateField>                                    
                                    <asp:BoundField HeaderText="Service" DataField="OperatorType" ItemStyle-Width="120"/>  
                                   <%-- <asp:TemplateField HeaderText="WlSerCharInPercentag">
                                        <ItemTemplate>
                                        <asp:Label ID="WlSerCharInPercentag" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.WlSerCharInPercentag") %>'></asp:Label>                                           
                                        </ItemTemplate>
                                    </asp:TemplateField>--%>  
                                    <asp:TemplateField HeaderText="WlSerChaInRS">
                                        <ItemTemplate>
                                        <asp:Label ID="WlSerChaInRS" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.WlSerChaInRS") %>'></asp:Label>                                           
                                        </ItemTemplate>
                                    </asp:TemplateField>                                 
                                     <%--<asp:TemplateField HeaderText="DS Ser.Charge In%">
                                        <ItemTemplate>
                                        <asp:TextBox ID="txtDSSerCharInPercentag" Width="85px" MaxLength="3"  runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.SerChargeINPer") %>' onKeyUp="numericFilter(this);"></asp:TextBox>
                                        </ItemTemplate>
                                    </asp:TemplateField>  --%>
                                    <asp:TemplateField HeaderText="DS Ser.Charge IN Rs">
                                        <ItemTemplate>
                                        <asp:TextBox ID="txtDSSerChaInRS" Width="85px" MaxLength="3"  runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.SerChargeINRS") %>' onKeyUp="numericFilter(this);"></asp:TextBox>
                                        </ItemTemplate>
                                    </asp:TemplateField> 
                                   <asp:TemplateField HeaderText="Agent Ser.Charge IN Rs">
                                        <ItemTemplate>
                                        <asp:TextBox ID="txtAgentBillSerChaInRS" Width="85px" MaxLength="3"  runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.UserSerChargeINRS") %>' onKeyUp="numericFilter(this);"></asp:TextBox>
                                        </ItemTemplate>
                                    </asp:TemplateField> 
                                </Columns>
                        <EditRowStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                        <AlternatingRowStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                    </asp:GridView>
                    
                    <asp:GridView ID="GVOtherServices" runat="server" AutoGenerateColumns="false" 
                        GridLines="None"  Width="100%" HorizontalAlign="Center" ShowFooter="True" 
                        onrowdatabound="GVOtherServices_RowDataBound" DataKeyNames="WlCommInPercentag,WlSerChaInRS,MobileDthOperatorID">
                        <FooterStyle BackColor="#dddee0" Font-Bold="True" ForeColor="Black" />
                        <PagerStyle BackColor="#dddee0" ForeColor="White" HorizontalAlign="Center" />
                        <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                        <HeaderStyle BackColor="#dddee0" Font-Bold="True" ForeColor="Black" />
                        <EditRowStyle BackColor="#2461BF" />
                        <AlternatingRowStyle BackColor="White" />
                        <Columns>
                            <asp:TemplateField>
                                <ItemTemplate >GVWlRechargeComm
                                    <asp:CheckBox ID="chkbox" runat="server" />
                                    <%#Container.DataItemIndex+1 %>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Operator" ItemStyle-Width="140">
                                <ItemTemplate>
                                    <asp:Label ID="lblOperator" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.OperatorName") %>'></asp:Label>
                                </ItemTemplate>
                            </asp:TemplateField>                                    
                            <asp:BoundField HeaderText="Service" DataField="OperatorType" ItemStyle-Width="140"/>       
                            
                            <asp:BoundField HeaderText="My Margin" DataField="wlmargin" ItemStyle-Width="140"/>  
                             
                            <asp:TemplateField HeaderText="WlCommInPercentag"  Visible="false">
                                <ItemTemplate>
                                    <asp:Label ID="WlCommInPercentag" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.WlCommInPercentag") %>'></asp:Label>                                           
                                </ItemTemplate>
                             </asp:TemplateField> 
                                           
                             <asp:TemplateField HeaderText="WlSerChaInRS"  Visible="false">
                                        <ItemTemplate>
                                        <asp:Label ID="WlSerChaInRS" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.WlSerChaInRS") %>'></asp:Label>                                           
                                        </ItemTemplate>
                             </asp:TemplateField> 
                                                         
                            <asp:TemplateField HeaderText="DS Margin(in %)" ItemStyle-Width="140">
                                <ItemTemplate>
                                    <asp:TextBox ID="txtUserCommInPercentag" Width="85px" MaxLength="3"  runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.CommINPer") %>' onKeyUp="numericFilter(this);"></asp:TextBox>%
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="DS Margin(in Rs.)" ItemStyle-Width="140">
                                <ItemTemplate>
                                    <asp:TextBox ID="txtUserSerCharInRs" Width="85px" MaxLength="3" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.CommINRS") %>' onblur="return fixedlength(this, event, 1);" onkeypress="return fixedlength(this, event, 1);" onkeyup="return fixedlength(this, event, 1);"></asp:TextBox>Rs.
                                </ItemTemplate>
                            </asp:TemplateField>                                                                                                          
                         </Columns>
                        <EditRowStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                        <AlternatingRowStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                    </asp:GridView>

                    <asp:GridView ID="GVDMR" runat="server" AutoGenerateColumns="false" 
                        GridLines="None"  Width="100%" HorizontalAlign="Center" ShowFooter="True" DataKeyNames="MobileDthOperatorID">
                        <FooterStyle BackColor="#dddee0" Font-Bold="True" ForeColor="Black" />
                        <PagerStyle BackColor="#dddee0" ForeColor="White" HorizontalAlign="Center" />
                        <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                        <HeaderStyle BackColor="#dddee0" Font-Bold="True" ForeColor="Black" />
                        <EditRowStyle BackColor="#2461BF" />
                        <AlternatingRowStyle BackColor="White" />
                       <Columns>
                                    <asp:TemplateField ItemStyle-Width="5%">
                                        <ItemTemplate >
                                            <asp:CheckBox ID="chkbox" runat="server" />
                                            <%#Container.DataItemIndex + 1 %>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="Operator" ItemStyle-Width="20%">
                                        <ItemTemplate>
                                            <asp:Label ID="lblOperator" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.OperatorName") %>'></asp:Label>
                                        </ItemTemplate>
                                    </asp:TemplateField>                                    
                                    <asp:BoundField HeaderText="Service" DataField="OperatorType" ItemStyle-Width="10%"/>  
                                   <asp:TemplateField HeaderText="Slap From" ItemStyle-Width="10%">
                                        <ItemTemplate>
                                            <asp:Label ID="lblSlapFrom" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.SlapFrom") %>'></asp:Label>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                  <asp:TemplateField HeaderText="Slap To" ItemStyle-Width="10%">
                                        <ItemTemplate>
                                            <asp:Label ID="lblSlapTo" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.SlapTo") %>'></asp:Label>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="WL Charge(Rs)" ItemStyle-Width="15%">
                                        <ItemTemplate>
                                            <asp:Label ID="lblWlDMRCommission" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.WlSerChaInRS") %>'></asp:Label>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    
                                    <asp:TemplateField HeaderText="DS Commission(Rs)" ItemStyle-Width="15%">
                                        <ItemTemplate>
                                            <asp:TextBox ID="DsDMRCommission" Width="95px" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.CommINRS") %>'
                                                onKeyUp="numericFilter(this);" oncopy="return false"  onpaste="return false" oncut="return false" onmousedown="DisableRightClick(event)" onkeydown="return DisableCtrlKey(event)" autocomplete="off"></asp:TextBox>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="Agent Charge(Rs)" ItemStyle-Width="15%">
                                        <ItemTemplate>
                                            <asp:TextBox ID="UserDMRCommission" Width="95px" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.UserSerChargeINRS") %>'  onKeyUp="numericFilter(this);"></asp:TextBox>
                                        </ItemTemplate>
                                    </asp:TemplateField>                                                                     
                                </Columns>
                        <EditRowStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                        <AlternatingRowStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                    </asp:GridView>

                    <asp:GridView ID="GVTravel" runat="server" AutoGenerateColumns="false" 
                        GridLines="None"  Width="100%" HorizontalAlign="Center" ShowFooter="True" DataKeyNames="MobileDthOperatorID" Visible=false>
                        <FooterStyle BackColor="#dddee0" Font-Bold="True" ForeColor="Black" />
                        <PagerStyle BackColor="#dddee0" ForeColor="White" HorizontalAlign="Center" />
                        <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                        <HeaderStyle BackColor="#dddee0" Font-Bold="True" ForeColor="Black" />
                        <EditRowStyle BackColor="#2461BF" />
                        <AlternatingRowStyle BackColor="White" />
                       <Columns>
                                    <asp:TemplateField>
                                        <ItemTemplate >
                                            <asp:CheckBox ID="chkbox" runat="server" />
                                            <%#Container.DataItemIndex + 1 %>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="Operator" ItemStyle-Width="170">
                                        <ItemTemplate>
                                            <asp:Label ID="lblOperator" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.OperatorName") %>'></asp:Label>
                                        </ItemTemplate>
                                    </asp:TemplateField>                                    
                                    <asp:BoundField HeaderText="Service" DataField="OperatorType" ItemStyle-Width="170"/>                                    
                                    <asp:TemplateField HeaderText="My Margin" ItemStyle-Width="170">
                                        <ItemTemplate>
                                            <asp:Label ID="lblWlCommission" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.WlCommInPercentag") %>'></asp:Label>%
                                            <%--<asp:TextBox ID="txtCommission" Width="95px" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.WlCommInPercentag") %>'></asp:TextBox>%--%>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    
                                    <asp:TemplateField HeaderText="DSMargin(in%)" ItemStyle-Width="170">
                                        <ItemTemplate>
                                            <asp:TextBox ID="DsCommission" Width="95px" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.CommINPer") %>'
                                                onKeyUp="numericFilter(this);" oncopy="return false"  onpaste="return false" oncut="return false" onmousedown="DisableRightClick(event)" onkeydown="return DisableCtrlKey(event)" autocomplete="off"></asp:TextBox>%
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                      
                                    <%--<asp:TemplateField HeaderText="Margin(in %)" ItemStyle-Width="170">
                                        <ItemTemplate>
                                            <asp:TextBox ID="UserCommission" Width="95px" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.UserCommInPercentag") %>'  onKeyUp="numericFilter(this);"></asp:TextBox>%
                                        </ItemTemplate>
                                    </asp:TemplateField>       --%>                                                              
                                </Columns>
                        <EditRowStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                        <AlternatingRowStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                    </asp:GridView>

                </td>
            </tr>
            <tr><td colspan="4" style="height:30px"></td></tr>
                    <tr><td colspan="4" style="text-align:center"><asp:Button ID="btnSubmit" 
                            runat="server" Text="Submit" CssClass="button active" 
                            onclick="btnSubmit_Click" /></td></tr>
            <tr>
                <td colspan="4" style="height: 30px"><asp:ScriptManager ID="ScriptManager1" runat="server">
                    </asp:ScriptManager>
                </td>
            </tr>
        </table>
    </div>  
</asp:Content>


