<%@ Page Language="C#" MasterPageFile="~/Admin/MasterPage/AdminMasterPage.master" AutoEventWireup="true" CodeFile="Report.aspx.cs" 
Inherits="Admin_Report"  %>

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

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

    <script src="script/ddlevelsmenu.js" type="text/javascript"></script>
     <script src="https://code.jquery.com/jquery-1.12.4.min.js"></script>
     <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.min.js"></script>

     <link rel="stylesheet" href="https://code.jquery.com/ui/1.12.1/themes/smoothness/jquery-ui.css" />

    <%--<script src="script/func.js" type="text/javascript"></script>--%>
    <script type="text/javascript" language="javascript">
        function showDiv() {
            document.getElementById("view").style.display = 'block';
            document.getElementById("fill").style.display = 'block';
        }
    </script>

    <style type="text/css">
        .HeaderFreeze
        {
            height: 40px;
            top: 80px;
        }
    </style>

 <script>
     function popimage(btn) {
         FromImage = $(btn)
         ToImage = $("#Image1")
         ToImage.attr("src", FromImage.attr("src"))

         pHeight = ($(window).height() * 0.96)
         pWidth = ($(window).width() * 0.80)

         myDialog = $("#imagepop");
         myDialog.dialog({
             title: "Fighter",
             modal: true,
             height: pHeight,
             width: pWidth,
             closeText: "",
             show: "fade",
             buttons: {

                 Ok: function () {
                     myDialog.dialog("close")
                 }
             }
         })
     }
 </script>
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
   
    <asp:UpdatePanel ID="updpanel" runat="server">
    <ContentTemplate>
    <table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
   <tr><td colspan="4">&nbsp;</td>
   </tr>
   <tr>
    <td width="31%">&nbsp;</td>
    <td width="12%">Select Report Type</td>
    <td width="1%"><strong>:</strong></td>
    <td width="56%"><asp:DropDownList ID="ddl_Report_Type" runat="server" AutoPostBack="true" 
            onselectedindexchanged="ddl_Report_Type_SelectedIndexChanged" >
                    <asp:ListItem>Select</asp:ListItem>
                    <asp:ListItem>Transaction Report</asp:ListItem>
                    <asp:ListItem>Flight Report</asp:ListItem>
                    <asp:ListItem>Fund Report</asp:ListItem>
                    <asp:ListItem>User Registration Report</asp:ListItem>
                    <asp:ListItem>Account Statement</asp:ListItem>
                    <asp:ListItem>SMS Report</asp:ListItem>
                    <asp:ListItem>Cancle Txn Report</asp:ListItem>
                    <asp:ListItem>Money Transfer Report</asp:ListItem>
                    <asp:ListItem>Train Transfer Report</asp:ListItem>
                    </asp:DropDownList>
                    
                    <asp:RequiredFieldValidator ID="rfv_ddl_Report_Type" runat="server" ErrorMessage="Please Select Report Type" InitialValue="Select" 
                       Display="None" ControlToValidate="ddl_Report_Type"></asp:RequiredFieldValidator>
                                
                    <cc1:ValidatorCalloutExtender ID="ValidatorCalloutExtender1"  TargetControlID="rfv_ddl_Report_Type" runat="server">
                    </cc1:ValidatorCalloutExtender>        
       
     </td>
 </tr>  
   <tr><td colspan="4">
  <%--<div id="Div_TransactionReport" runat="server" visible="false">
      <table width="100%" border="0" cellspacing="0" cellpadding="0" style="text-align:left; padding:0 0 0 -10px;">
      <tr>
        <td width="31%">&nbsp;</td>
        <td width="12%">Select Report</td>
        <td width="1%"><strong>:</strong></td>
        <td width="56%"><asp:DropDownList ID="ddl_Report" runat="server" 
                AutoPostBack="True" onselectedindexchanged="ddl_Report_SelectedIndexChanged">
                        <asp:ListItem>Select</asp:ListItem>
                        <asp:ListItem>Recharge Transaction</asp:ListItem>
                        <asp:ListItem>Premium Payments</asp:ListItem>
                        <asp:ListItem>Pan Card</asp:ListItem>
                        <asp:ListItem>Digital Signature</asp:ListItem>
                        <asp:ListItem>Magazine</asp:ListItem>
                        </asp:DropDownList>
                        
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="Please Select Report" InitialValue="Select" 
                      Display="None" ControlToValidate="ddl_Report"></asp:RequiredFieldValidator>
                                
                    <cc1:ValidatorCalloutExtender ID="ValidatorCalloutExtender2"  TargetControlID="RequiredFieldValidator1" runat="server">
                    </cc1:ValidatorCalloutExtender>
         </td>
      </tr>
    </table>
  </div>--%>
  <div id="Div_PanReport" runat="server" visible="false" >
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td width="31%">&nbsp;</td>
            <td width="12%">Status Type</td>
            <td width="1%"><strong>:</strong></td>
            <td width="56%"><asp:DropDownList ID="ddl_PanReport" runat="server" >
                            <asp:ListItem>Select</asp:ListItem>
                            <asp:ListItem>Success</asp:ListItem>
                <asp:ListItem>Pending</asp:ListItem>
                <asp:ListItem>Failed</asp:ListItem>
                            </asp:DropDownList>                             
                             <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ErrorMessage="Please Select Txn Status" InitialValue="Select" 
                      Display="None" ControlToValidate="ddl_PanReport"></asp:RequiredFieldValidator>
                                
                    <cc1:ValidatorCalloutExtender ID="ValidatorCalloutExtender3"  TargetControlID="RequiredFieldValidator2" runat="server">
                    </cc1:ValidatorCalloutExtender>          
             </td>
            </tr>
      </table>
  </div>
  <div id="div_UserRegistration" runat="server">
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="31%">&nbsp;</td>
        <td width="12%">User Registration</td>
        <td width="1%"><strong>:</strong></td>
        <td width="56%"><asp:DropDownList ID="ddl_UserRegistration" runat="server"
                AutoPostBack="True" 
                onselectedindexchanged="ddl_UserRegistration_SelectedIndexChanged">
                       <asp:ListItem>Select</asp:ListItem>
                       <asp:ListItem>Agent Registration</asp:ListItem>
                       <asp:ListItem>Distributor Registration</asp:ListItem>
                       <asp:ListItem>MDS Registration</asp:ListItem>
                       <asp:ListItem>WL Registration</asp:ListItem>
                       </asp:DropDownList>
                                              
                       <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ErrorMessage="Please Select User " InitialValue="Select" 
                      Display="None" ControlToValidate="ddl_UserRegistration"></asp:RequiredFieldValidator>
                                
                    <cc1:ValidatorCalloutExtender ID="ValidatorCalloutExtender4"  TargetControlID="RequiredFieldValidator3" runat="server">
                    </cc1:ValidatorCalloutExtender> 
        </td>
      </tr>
      </table>
  </div>
  <div id="Div_AccountStatement" runat="server">
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="31%">&nbsp;</td>
        <td width="12%">Account Statement</td>
        <td width="1%"><strong>:</strong></td>
        <td width="56%"><asp:DropDownList ID="ddl_AccountStatement" runat="server" 
                AutoPostBack="True" AppendDataBoundItems="true" 
                onselectedindexchanged="ddl_AccountStatement_SelectedIndexChanged">
                        </asp:DropDownList>
                        
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ErrorMessage="Please Select Account Statement " InitialValue="Select" 
                      Display="None" ControlToValidate="ddl_AccountStatement"></asp:RequiredFieldValidator>
                                
                    <cc1:ValidatorCalloutExtender ID="ValidatorCalloutExtender5"  TargetControlID="RequiredFieldValidator4" runat="server">
                    </cc1:ValidatorCalloutExtender>
        
        </td>
      </tr>
      </table>
   </div>
  </td>
  </tr>
   <tr>
    <td>&nbsp;</td>
    <td>Date From</td>
    <td><strong>:</strong></td>
    <td><asp:TextBox ID="txtFrmDate" runat="server" style="width:219px;"></asp:TextBox>&nbsp;&nbsp;&nbsp;<asp:Button 
            ID="btnref" runat="server" Text="Refresh" onclick="btnref_Click" />
        <cc1:CalendarExtender ID="CalendarExtender1" runat="server" TargetControlID="txtFrmDate" PopupPosition="Right" Format="yyyy-MM-dd">
                                </cc1:CalendarExtender>
    </td>
  </tr>
  
  <tr>
    <td>&nbsp;</td>
    <td>Date To</td>
    <td><strong>:</strong></td>
    <td><asp:TextBox ID="txtToDate" runat="server" style="width:219px;"></asp:TextBox>
        <cc1:CalendarExtender ID="CalendarExtender2" runat="server" TargetControlID="txtToDate" PopupPosition="Right" Format="yyyy-MM-dd">
                                </cc1:CalendarExtender>
    </td>
  </tr>
  
  <tr>
    <td>&nbsp;</td>
    <td></td>
    <td><strong></strong></td>
    <td>  </td>
  </tr>
  

      
   <tr><td colspan="4">
         <asp:GridView ID="gvAccountReport" runat="server" AutoGenerateColumns="False" BorderColor="#CCCCCC"
            BackColor="White" Font-Bold="False" Font-Italic="False" Font-Overline="False" OnRowDataBound="gvAccountReport_RowDataBound"
            Font-Strikeout="False" Font-Underline="False"  Width="100%" HorizontalAlign="Center" ShowFooter="True"   >
            <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 HeaderText="S No">
                    <ItemTemplate>
                        <%#Container.DataItemIndex+1 %>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:BoundField HeaderText="Txn.Date" DataField="Txn_Date" />
                <asp:BoundField HeaderText="Txn.Time" DataField="Txn_Time" />
                <asp:BoundField HeaderText="User Id" DataField="UserId" />
                <asp:BoundField HeaderText="DS Id" DataField="dsId" />
                <asp:BoundField HeaderText="Service Name" DataField="SERVICE_NAME" />
                <asp:BoundField HeaderText="Operator Name" DataField="OperatorName" />
                <asp:BoundField HeaderText="Connection No." DataField="ConnectionNo"/>
                <asp:BoundField HeaderText="Refrence Id" DataField="RefrenceId" />                            
                <asp:BoundField HeaderText="Amount" DataField="Amount"/>
                <asp:BoundField HeaderText="Margin" DataField="Margin"/>
                <asp:BoundField HeaderText="Net Amount" DataField="NetAmount"/>                            
                <asp:BoundField HeaderText="Txn" DataField="TxnType"/> 
                <asp:BoundField HeaderText="Vendor" DataField="ServiceVendor" />                           
                <asp:BoundField HeaderText="Status" DataField="Status" />
            </Columns>
            <EditRowStyle HorizontalAlign="Center" VerticalAlign="Middle" />
            <AlternatingRowStyle HorizontalAlign="Center" VerticalAlign="Middle" />
        </asp:GridView>     
        
        <asp:GridView ID="GridViewAmountReport" runat="server" AutoGenerateColumns="False" BorderColor="#CCCCCC"
            BackColor="White" Font-Bold="False" Font-Italic="False" Font-Overline="False"
            Font-Strikeout="False" Font-Underline="False"  Width="100%" HorizontalAlign="Center" ShowFooter="True"   >
            <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 HeaderText="S No">
                    <ItemTemplate>
                        <%#Container.DataItemIndex+1 %>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:BoundField HeaderText="Reg. Date" DataField="Reg_Date" />                
                <asp:BoundField HeaderText="User ID" DataField="UserID" />
                <asp:BoundField HeaderText="Service" DataField="Service" />                
                <asp:BoundField HeaderText="eGen Tx. Id" DataField="Txnid" />
                <asp:BoundField HeaderText="Op. Bal" DataField="Opbal"/>
                <asp:BoundField HeaderText="Amount" DataField="Amount"/>                            
                <asp:BoundField HeaderText="Cl. Bal" DataField="ClBal"/>                            
                <asp:BoundField HeaderText="Res. Date & Time" DataField="PaymentDate" />
                <asp:BoundField HeaderText="Status" DataField="STATUS" />
                <asp:BoundField HeaderText="Remark" DataField="REMARKS" />
            </Columns>
            <EditRowStyle HorizontalAlign="Center" VerticalAlign="Middle" />
            <AlternatingRowStyle HorizontalAlign="Center" VerticalAlign="Middle" />
        </asp:GridView>
        
        <asp:GridView ID="GridViewRegUser" runat="server" AutoGenerateColumns="False" BorderColor="#CCCCCC"
            BackColor="White" Font-Bold="False" Font-Italic="False" Font-Overline="False"
            Font-Strikeout="False" Font-Underline="False"  Width="100%" HorizontalAlign="Center" ShowFooter="True"   >
            <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 HeaderText="S No">
                    <ItemTemplate>
                        <%#Container.DataItemIndex+1 %>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:BoundField HeaderText="Reg. Date" DataField="Reg_Date" />
                <asp:BoundField HeaderText="User ID" DataField="UserID" />
                <asp:BoundField HeaderText="Name" DataField="Name" />
                <asp:BoundField HeaderText="E-mail ID" DataField="EMAILID" />
                <asp:BoundField HeaderText="Mobile No." DataField="MOBILENO"/>
                <asp:BoundField HeaderText="Pan No." DataField="PANNUMBER" />                
                <asp:BoundField HeaderText="City" DataField="OFFICECITY"/>
                <asp:BoundField HeaderText="State" DataField="OFFICEDISTRIC"/>                            
                <asp:BoundField HeaderText="Web Status" DataField="FLAG"/>                            
                <asp:BoundField HeaderText="SMS Status" DataField="FLAGSMS" />
                <asp:BoundField HeaderText="Balance" DataField="NETAMOUNT" />
            </Columns>
            <EditRowStyle HorizontalAlign="Center" VerticalAlign="Middle" />
            <AlternatingRowStyle HorizontalAlign="Center" VerticalAlign="Middle" />
        </asp:GridView>
        
        <asp:GridView ID="GridViewSMSPeport" runat="server" AutoGenerateColumns="False" BorderColor="#CCCCCC"
            BackColor="White" Font-Bold="False" Font-Italic="False" Font-Overline="False"
            Font-Strikeout="False" Font-Underline="False"  Width="100%" HorizontalAlign="Center" ShowFooter="True"   >
            <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:BoundField DataField="USERNAME" HeaderText="User Name" ItemStyle-Width="60px" ItemStyle-Height="10px"/>
                <asp:BoundField DataField="Url" HeaderText="Request SMS" ItemStyle-Width="680px" ItemStyle-Height="10px"/>
                <asp:BoundField DataField="ResponceMsg" HeaderText="Response SMS" ItemStyle-Width="650px" ItemStyle-Height="10px"/>
            </Columns>
            <EditRowStyle HorizontalAlign="Center" VerticalAlign="Middle" />
            <AlternatingRowStyle HorizontalAlign="Center" VerticalAlign="Middle" />
        </asp:GridView>
        
        <asp:GridView ID="GridViewAccountStatement" runat="server" AutoGenerateColumns="False" BorderColor="#CCCCCC"
            BackColor="White" Font-Bold="False" Font-Italic="False" Font-Overline="False"
            Font-Strikeout="False" Font-Underline="False"  Width="100%" HorizontalAlign="Center" ShowFooter="True"   >
            <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 HeaderText="S No">
                    <ItemTemplate>
                        <%#Container.DataItemIndex+1 %>
                    </ItemTemplate>
                </asp:TemplateField>                      
                <asp:BoundField HeaderText="Txn Date Time" DataField="TRANSACTION_DATETIME" />
                <asp:BoundField HeaderText="Service" DataField="SERVICE_NAME" />
                <asp:BoundField HeaderText="Txn Id" DataField="REFERENCE_NUMBER" />
                <asp:BoundField HeaderText="Mobile No." DataField="MobileDTHNumber"/>
                <asp:BoundField HeaderText="Amount" DataField="REQUEST_AMOUNT"/>
                <asp:BoundField HeaderText="Margin" DataField="total_commission"/>
                <asp:BoundField HeaderText="Charge" DataField="TOTAL_SERVICE_CHARGE"/>
                <asp:BoundField HeaderText="Net.Amt" DataField="NET_AMOUNT"  />
                <asp:BoundField HeaderText="Type" DataField="ACTION_ON_AMOUNT"/>
                <asp:BoundField HeaderText="Balance" DataField="FINAL_BAL_AMOUNT"/>
                <asp:BoundField HeaderText="Status" DataField="Status" />
            </Columns>
            <EditRowStyle HorizontalAlign="Center" VerticalAlign="Middle" />
            <AlternatingRowStyle HorizontalAlign="Center" VerticalAlign="Middle" />
        </asp:GridView>
        
        <asp:GridView ID="gv_PancardReport" runat="server" AutoGenerateColumns="False" BorderColor="#CCCCCC"
            BackColor="White" Font-Bold="False" Font-Italic="False" Font-Overline="False"
            Font-Strikeout="False" Font-Underline="False"  Width="100%" HorizontalAlign="Center" ShowFooter="True"  OnRowDataBound="gv_PancardReport_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 HeaderText="S No">
                    <ItemTemplate>
                        <%#Container.DataItemIndex+1 %>
                    </ItemTemplate>
                </asp:TemplateField>
                                    
                <asp:BoundField HeaderText="CA No." DataField="CANo" />
                <asp:BoundField HeaderText="Txn Date" DataField="TxnDate" />
                <asp:BoundField HeaderText="Receipt No" DataField="ReceiptNo"/>
                <asp:BoundField HeaderText="Txn RefNo" DataField="ReferenceTxnId" /> 
                 <asp:BoundField HeaderText="Amount" DataField="Amount" /> 
                <asp:BoundField HeaderText="Status" DataField="Status" />
                <asp:BoundField HeaderText="Requested On" DataField="CreatedOn"/>
                <asp:BoundField HeaderText="Refund Txn Id" DataField="RefundTxnId"/>
                <asp:BoundField HeaderText="Refunded On" DataField="ResponsedOn"/>
                <asp:BoundField HeaderText="Remarks" DataField="VendorRemark"/>
                <asp:TemplateField HeaderText="Image">
                <ItemTemplate>
                    <asp:ImageButton ID="btnImage" runat="server" Height="68px" Width="149px"
                        OnClientClick ="popimage(this);"/>
                </ItemTemplate>
            </asp:TemplateField>
            </Columns>
            <EditRowStyle HorizontalAlign="Center" VerticalAlign="Middle" />
            <AlternatingRowStyle HorizontalAlign="Center" VerticalAlign="Middle" />
        </asp:GridView>
      </td>
  </tr>  
   <tr>
    <td><asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>&nbsp;</td>
    <td>&nbsp;</td>
    <td><strong>&nbsp;</strong></td>
    <td style="padding:10px ;"><asp:Button ID="btn_Submit" runat="server" 
            Text="Submit" class="button active" onclick="btn_Submit_Click"/> </td>
  </tr>
  <tr><td colspan="4" style="text-align:center">
      <asp:Button ID="btnDownload" runat="server" Text="Download" 
          class="button active" onclick="btnDownload_Click" /></td>
  </tr>

</table>
              </ContentTemplate>
</asp:UpdatePanel>
     <div id="imagepop" style="display:none;text-align:center;height:80%">
                    <asp:Image ID="Image1" runat="server" ClientIDMode="Static"
                    style="height:96%"/>
                </div>

</asp:Content>

