<%@ Page Title="TaxAnalysis Page" Language="C#" MasterPageFile="~/SunMaster.Master"
    AutoEventWireup="true" CodeBehind="TaxAnalysis.aspx.cs" Inherits="SUNWEB.TaxAnalysis" %>

<%@ Register Assembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
    Namespace="System.Web.UI.DataVisualization.Charting" TagPrefix="asp" %>
<%@ Register Assembly="AjaxControlToolkit" TagPrefix="asp" Namespace="AjaxControlToolkit" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <link type="text/css" rel="Stylesheet" href="css/style.css" />
    <link href="css/Gridstyle.css" rel="Stylesheet" type="text/css" />
    <style type="text/css">
        @media only screen and (max-width: 600px)
        {
            table, th, td
            {
                font-size: 10px;
                font-weight: bold;
            }
        
            .Labels
            {
                font-size: 10px;
            }
            .alnright
            {
                text-align: right;
            }
        
        }
    </style>
    <style type="text/css">
        .overlay
        {
            position: fixed;
            top: 0px;
            left: 0px;
            z-index: 0;
            height: 100%;
            width: 100%;
            top: 0;
            background-color: White;
            filter: alpha(opacity=60);
            opacity: 0.9;
            -moz-opacity: 1;
        }
        
        .LoadingDivCss
        {
            margin: 0;
            position: absolute;
            top: 50%;
            left: 50%;
            margin-right: -50%;
            transform: translate(-50%, -50%);
        }
        
        .LoadingImgCss
        {
            height: 100px;
            width: 100px;
        }
    </style>
    <script type="text/javascript">
        function showProgress() {
            var updateProgress = $get("<%= UpdateProgress.ClientID %>");
            updateProgress.style.display = "block";
        }
    
    </script>
    <script type="text/javascript">
        function switchViews(obj, row) {
            var div = document.getElementById(obj);
            var img = document.getElementById('img' + obj);

            if (div.style.display == "none") {
                div.style.display = "inline";
                img.src = "IMG/minus.gif";
            } else {
                div.style.display = "none";
                img.src = "IMG/plus.gif";
            }
        }

        function CheckOne(obj) {
            var grid = obj.parentNode.parentNode.parentNode;
            var inputs = grid.getElementsByTagName("input");
            for (var i = 0; i < inputs.length; i++) {
                if (inputs[i].type == "checkbox") {
                    if (obj.checked && inputs[i] != obj && inputs[i].checked) {
                        inputs[i].checked = false;
                    }
                }
            }
        }  


    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <div align="left">
        <asp:Button ID="btnExcel" runat="server" Text="Excel" ToolTip="To Export the Report Click Here"
            BackColor="Green" BorderColor="Green" CssClass="btn btn-success btn-xs" OnClick="btnExcel_Click" />
    </div>
    <asp:UpdatePanel ID="Upanel" runat="server" UpdateMode="Conditional">
        <ContentTemplate>
            <div class="section-block">
                <h6 class="section-title">
                 SALES TAX ANALYSIS REPORT
                </h6>
            </div>
            <%--
            <table style="margin-left: 1%; width: 98%;">
                <tr>
                   <td style="font-size:large; width: 50%; font-family:'Open Sans', sans-serif; font-weight:bolder;">
                      
                          SALES TAX ANALYSIS     
                      
                    </td>
                                    
                </tr>
            </table>--%>
            <div class="row">
                <div class="col-xl-12 col-lg-12 col-md-12 col-sm-12 col-12">
                    <div class="card">
                        <div class="card-body">
                            <div class="form-row">
                                <div class="col-xl-4 col-lg-4 col-md-12 col-sm-12 col-12 mb-2">
                                    <caption>
                                        <label for="validationCustom03">
                                            From
                                        </label>
                                        <asp:TextBox ID="txtFromDt" class="form-control" runat="server"></asp:TextBox>
                                        <asp:CalendarExtender ID="calexdFrom" Format="yyyy-MM-dd" runat="server" TargetControlID="txtFromDt"
                                            PopupPosition="BottomLeft" FirstDayOfWeek="Sunday"></asp:CalendarExtender>
                                    </caption>
                                </div>
                                <div class="col-xl-4 col-lg-4 col-md-12 col-sm-12 col-12 mb-2">
                                    <label for="validationCustom03">
                                        To
                                    </label>
                                    <asp:TextBox ID="txtToDt" class="form-control" runat="server"></asp:TextBox>
                                    <asp:CalendarExtender ID="calexdTo" Format="yyyy-MM-dd" runat="server" TargetControlID="txtToDt"
                                        PopupPosition="BottomLeft" FirstDayOfWeek="Sunday"></asp:CalendarExtender>
                                </div>
                                <div class="col-xl-4 col-lg-4 col-md-12 col-sm-12 col-12 mb-2">
                                    <label for="validationCustom03">
                                        <asp:Label ID="lblBranchAliasName" runat="server" Text="Branch"></asp:Label></label>
                                    <asp:DropDownList ID="cmbBranches" CssClass="custom-select" runat="server" AutoPostBack="true"
                                        OnSelectedIndexChanged="cmbBranches_SelectedIndexChanged1">
                                    </asp:DropDownList>
                                </div>
                                <div class="col-xl-4 col-lg-4 col-md-12 col-sm-12 col-12 mb-2">
                                    <asp:Button ID="btnGetReports" runat="server" Text="Apply" Class="btn btn-primary"
                                        OnClick="btnGetReports_Click" OnClientClick="return validate()" />
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <br />
            <div class="row">
                <div class="col-xl-12 col-lg-12 col-md-12 col-sm-12 col-12">
                    <div class="card">
                      
                            <h5  class="card-header" id="idTax" runat="server">
                                <asp:Label ID="lblMsgTotalSelection" runat="server" CssClass="Labels" ></asp:Label></b>
                                <asp:Label ID="DTTT" runat="server" CssClass="Labels"></asp:Label></b>
                            </h5>
                            <%-- <asp:Button ID="btnExcel" runat="server" Text="Excel" ToolTip="To Export the Report Click Here"
                                 CssClass="btn btn-success active" OnClick="btnExcel_Click" /> --%>
                     
                        <div class="card-body">
                            <div class="table-responsive">
                                <table id="Table1" class="table table-striped table-bordered second" style="width: 100%">
                                    <tbody>
                                        <caption>
                                            <asp:GridView ID="grdTaxAnalysis" runat="server" CellPadding="4" ForeColor="#333333" EmptyDataText="No Data Found !"
                                                Width="850px" GridLines="None" Font-Size="12px" AutoGenerateColumns="False" OnRowCommand="grdTaxAnalysis_RowCommand"
                                                OnSelectedIndexChanged="grdTaxAnalysis_SelectedIndexChanged" OnRowDataBound="grdTaxAnalysis_RowDataBound"
                                                DataKeyNames="businessdate">
                                                <Columns>
                                                    <asp:TemplateField>
                                                        <ItemTemplate>
                                                            <a href="javascript:switchViews('div<%# Eval("businessdate") %>', 'one');">
                                                                <img id="imgdiv<%# Eval("businessdate") %>" alt="Click to show/hide Details" border="0"
                                                                    src="IMG/plus.gif" />
                                                            </a>
                                                        </ItemTemplate>
                                                        <AlternatingItemTemplate>
                                                            <a href="javascript:switchViews('div<%# Eval("businessdate") %>', 'alt');">
                                                                <img id="imgdiv<%# Eval("businessdate") %>" alt="Click to show/hide Details" border="0"
                                                                    src="IMG/plus.gif" />
                                                            </a>
                                                        </AlternatingItemTemplate>
                                                    </asp:TemplateField>
                                                    <asp:TemplateField HeaderText="DATE">
                                                        <ItemTemplate>
                                                            <asp:Label ID="Date" runat="server" Text='<%#Eval("businessdate","{0:yyyy-MM-dd}") %>'></asp:Label>
                                                        </ItemTemplate>
                                                        <ControlStyle BorderWidth="0px" />
                                                        <HeaderStyle BorderWidth="1px" HorizontalAlign="Center" />
                                                        <ItemStyle Width="180px" BorderWidth="1px" />
                                                    </asp:TemplateField>
                                                    <asp:TemplateField HeaderText="PAYMENT TYPE">
                                                        <ItemTemplate>
                                                            <asp:Label ID="Paymenttype" runat="server" Text='<%#Eval("Paymenttype") %>'></asp:Label>
                                                        </ItemTemplate>
                                                        <FooterTemplate>
                                                            <asp:Label ID="lblSubtotal" runat="server" Text='Grand Total :'></asp:Label>
                                                        </FooterTemplate>
                                                        <ControlStyle BorderWidth="0px" />
                                                        <HeaderStyle BorderWidth="1px" HorizontalAlign="Center" />
                                                        <ItemStyle Width="180px" BorderWidth="1px" />
                                                    </asp:TemplateField>
                                                    <%--<asp:BoundField ItemStyle-Width="215px" HeaderText="" />--%>
                                                    <asp:TemplateField HeaderText="TOTAL" ItemStyle-HorizontalAlign="Right">
                                                        <ItemTemplate>
                                                            <asp:Label ID="lbltotal" runat="server" Text='<%# string.Format("{0:n2}",Eval("Total")) %>'></asp:Label>
                                                        </ItemTemplate>
                                                        <FooterTemplate>
                                                            <asp:Label ID="lblGrandTotal" runat="server" Text="0" Font-Bold="true" ForeColor="White"></asp:Label>
                                                        </FooterTemplate>
                                                        <ControlStyle BorderWidth="0px" />
                                                        <HeaderStyle BorderWidth="1px" HorizontalAlign="Right" />
                                                        <ItemStyle Width="250px" BorderWidth="1px" />
                                                    </asp:TemplateField>
                                                    <asp:TemplateField HeaderText="TAXABLEAMOUNT" ItemStyle-HorizontalAlign="Right">
                                                        <ItemTemplate>
                                                            <asp:Label ID="lbltotalTaxableAmount" runat="server" Text='<%#string.Format("{0:n2}",Eval("taxableamount")) %>'></asp:Label>
                                                        </ItemTemplate>
                                                        <FooterTemplate>
                                                            <asp:Label ID="lblGtaxableamount" runat="server" Text="0" Font-Bold="true" ForeColor="White"></asp:Label>
                                                        </FooterTemplate>
                                                        <ControlStyle BorderWidth="0px" />
                                                        <HeaderStyle BorderWidth="1px" HorizontalAlign="Right" />
                                                        <ItemStyle Width="200px" BorderWidth="1px" />
                                                    </asp:TemplateField>
                                                    <asp:TemplateField HeaderText="SVC">
                                                        <ItemTemplate>
                                                            <asp:Label ID="lblTaxRate1" runat="server" Text='<%# string.Format("{0:n2}", Eval("tax1")) %>'></asp:Label>
                                                        </ItemTemplate>
                                                        <ControlStyle BorderWidth="0px" />
                                                        <HeaderStyle BorderWidth="1px" HorizontalAlign="Center" />
                                                        <ItemStyle Width="150px" BorderWidth="1px" />
                                                    </asp:TemplateField>
                                                    <asp:TemplateField HeaderText="GST" HeaderStyle-HorizontalAlign="Right">
                                                        <ItemTemplate>
                                                            <asp:Label ID="lblTaxRate2" runat="server" Text='<%# string.Format("{0:n2}", Eval("tax2")) %>'></asp:Label>
                                                        </ItemTemplate>
                                                        <ControlStyle BorderWidth="0px" />
                                                        <HeaderStyle BorderWidth="1px" HorizontalAlign="Right" />
                                                        <ItemStyle Width="150px" BorderWidth="1px" />
                                                    </asp:TemplateField>
                                                    <asp:TemplateField HeaderText="TAX 3" ItemStyle-HorizontalAlign="Right">
                                                        <ItemTemplate>
                                                            <asp:Label ID="lblTaxRate3" runat="server" Text='<%#Eval("tax3") %>'></asp:Label>
                                                        </ItemTemplate>
                                                        <ControlStyle BorderWidth="0px" />
                                                        <HeaderStyle BorderWidth="1px" HorizontalAlign="Center" />
                                                        <ItemStyle Width="150px" BorderWidth="1px" />
                                                    </asp:TemplateField>
                                                    <asp:TemplateField HeaderText="TAXAMOUNT" ItemStyle-HorizontalAlign="Right">
                                                        <ItemTemplate>
                                                            <asp:Label ID="lblTaxAmount" runat="server" HorizontalAlign="Center" Text='<%#string.Format("{0:n2}",Eval("TaxAmount"))  %>'></asp:Label>
                                                        </ItemTemplate>
                                                        <FooterTemplate>
                                                            <asp:Label ID="lblGtaxamount" runat="server" Text="0" Font-Bold="true" ForeColor="white"></asp:Label>
                                                        </FooterTemplate>
                                                        <ControlStyle BorderWidth="0px" />
                                                        <HeaderStyle BorderWidth="1px" HorizontalAlign="Center" />
                                                        <ItemStyle Width="180px" BorderWidth="1px" />
                                                    </asp:TemplateField>
                                                    <asp:TemplateField>
                                                        <ItemTemplate>
                                                            <tr>
                                                                <td colspan="100%" style="padding-left: 25px">
                                                                    <div id="div<%# Eval("businessdate") %>" style="display: none; left: 80px;">
                                                                        <asp:GridView ID="grdDetails" runat="server" AutoGenerateColumns="false" CellPadding="4"
                                                                            ForeColor="#333333" Height="150px" Width="850px" OnRowDataBound="OnRowDataBoundChild">
                                                                            <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
                                                                            <Columns>
                                                                                <asp:TemplateField HeaderText="TRANS.ID">
                                                                                    <ItemTemplate>
                                                                                        <asp:Label ID="lblTransID" runat="server" Text='<%#Eval("TransID") %>'></asp:Label>
                                                                                    </ItemTemplate>
                                                                                    <ControlStyle BorderWidth="0px" />
                                                                                    <HeaderStyle BorderWidth="1px" HorizontalAlign="Center" />
                                                                                    <ItemStyle Width="100px" BorderWidth="1px" />
                                                                                </asp:TemplateField>
                                                                                <asp:TemplateField HeaderText="PAYMENT.TYPE">
                                                                                    <ItemTemplate>
                                                                                        <asp:Label ID="lblPaymentType" runat="server" Text='<%#Eval("paymenttype") %>'></asp:Label>
                                                                                    </ItemTemplate>
                                                                                    <ControlStyle BorderWidth="0px" />
                                                                                    <HeaderStyle BorderWidth="1px" HorizontalAlign="Center" />
                                                                                    <ItemStyle Width="100px" BorderWidth="1px" />
                                                                                </asp:TemplateField>
                                                                                <asp:TemplateField HeaderText="SALES" HeaderStyle-HorizontalAlign="Right" ItemStyle-HorizontalAlign="Right">
                                                                                    <ItemTemplate>
                                                                                        <asp:Label ID="lblSales" runat="server" Text='<%# string.Format("{0:n2}", Eval("Sales"))%>'></asp:Label>
                                                                                    </ItemTemplate>
                                                                                    <ControlStyle BorderWidth="0px" />
                                                                                    <HeaderStyle BorderWidth="1px" HorizontalAlign="Center" />
                                                                                    <ItemStyle Width="150px" BorderWidth="1px" />
                                                                                </asp:TemplateField>
                                                                                <asp:TemplateField HeaderText="TAXABLEAMOUNT" HeaderStyle-Width="100px" ItemStyle-HorizontalAlign="Right">
                                                                                    <ItemTemplate>
                                                                                        <asp:Label ID="lblTaxablemaount" runat="server" Text='<%#Eval("Taxablemaount") %>'></asp:Label>
                                                                                    </ItemTemplate>
                                                                                    <ControlStyle BorderWidth="0px" />
                                                                                    <HeaderStyle BorderWidth="1px" HorizontalAlign="Center" />
                                                                                    <ItemStyle Width="130px" BorderWidth="1px" />
                                                                                </asp:TemplateField>
                                                                                <asp:TemplateField HeaderText="SC" ItemStyle-HorizontalAlign="Right">
                                                                                    <ItemTemplate>
                                                                                        <asp:Label ID="SC" runat="server" Text='<%#Eval("SVC") %>'></asp:Label>
                                                                                    </ItemTemplate>
                                                                                    <ControlStyle BorderWidth="0px" />
                                                                                    <HeaderStyle BorderWidth="1px" HorizontalAlign="Right" />
                                                                                    <ItemStyle Width="100px" BorderWidth="1px" />
                                                                                </asp:TemplateField>
                                                                                <asp:TemplateField HeaderText="GST" ItemStyle-HorizontalAlign="Right">
                                                                                    <ItemTemplate>
                                                                                        <asp:Label ID="lblTaxableamt" runat="server" Text='<%#Eval("GST") %>'></asp:Label>
                                                                                    </ItemTemplate>
                                                                                    <ControlStyle BorderWidth="0px" />
                                                                                    <HeaderStyle BorderWidth="1px" HorizontalAlign="Center" />
                                                                                    <ItemStyle Width="100px" BorderWidth="1px" />
                                                                                </asp:TemplateField>
                                                                                <asp:TemplateField HeaderText="Tax3" ItemStyle-HorizontalAlign="Right">
                                                                                    <ItemTemplate>
                                                                                        <asp:Label ID="lblTaxableamt3" runat="server" Text='<%#Eval("Tax3") %>'></asp:Label>
                                                                                    </ItemTemplate>
                                                                                    <ControlStyle BorderWidth="0px" />
                                                                                    <HeaderStyle BorderWidth="1px" HorizontalAlign="Center" />
                                                                                    <ItemStyle Width="100px" BorderWidth="1px" />
                                                                                </asp:TemplateField>
                                                                                <asp:TemplateField HeaderText="OTHER.TAX" ItemStyle-HorizontalAlign="Right">
                                                                                    <ItemTemplate>
                                                                                        <asp:Label ID="lblTax1" runat="server" Text='<%#Eval("Other_tax") %>'></asp:Label>
                                                                                    </ItemTemplate>
                                                                                    <ControlStyle BorderWidth="0px" />
                                                                                    <HeaderStyle BorderWidth="1px" HorizontalAlign="Center" />
                                                                                    <ItemStyle Width="100px" BorderWidth="1px" />
                                                                                </asp:TemplateField>
                                                                                <%--
                                                                        <asp:TemplateField HeaderText="Total">
                                                                            <ItemTemplate>
                                                                                <asp:Label ID="lblTax2" runat="server" Text='<%#Eval("Total") %>'></asp:Label>
                                                                            </ItemTemplate>
                                                                            <ControlStyle BorderWidth="0px" />
                                                                            <HeaderStyle BorderWidth="1px" HorizontalAlign="Center" />
                                                                            <ItemStyle Width="100px" BorderWidth="1px" />
                                                                        </asp:TemplateField>--%>
                                                                                <%--<asp:TemplateField HeaderText="Total">
                                                                            <ItemTemplate>
                                                                                <asp:Label ID="lblTotal" runat="server" Text='<%#Eval("Total") %>'></asp:Label>
                                                                            </ItemTemplate>
                                                                            <ControlStyle BorderWidth="0px" />
                                                                            <HeaderStyle BorderWidth="1px" HorizontalAlign="Center" />
                                                                            <ItemStyle Width="350px" BorderWidth="1px" />
                                                                        </asp:TemplateField>
                                                                        <asp:TemplateField HeaderText="TaxRate">
                                                                            <ItemTemplate>
                                                                                <asp:Label ID="lblTaxRate" runat="server" Text='<%#Eval("TaxRate") %>'></asp:Label>
                                                                            </ItemTemplate>
                                                                            <ControlStyle BorderWidth="0px" />
                                                                            <HeaderStyle BorderWidth="1px" HorizontalAlign="Center" />
                                                                            <ItemStyle Width="150px" BorderWidth="1px" />
                                                                        </asp:TemplateField>
                                                                        <asp:TemplateField HeaderText="TaxAmount">
                                                                            <ItemTemplate>
                                                                                <asp:Label ID="lblTaxAmount" runat="server" Text='<%#Eval("TaxAmount") %>'></asp:Label>
                                                                            </ItemTemplate>
                                                                            <ControlStyle BorderWidth="0px" />
                                                                            <HeaderStyle BorderWidth="1px" HorizontalAlign="Center" />
                                                                            <ItemStyle Width="150px" BorderWidth="1px" />
                                                                        </asp:TemplateField>--%>
                                                                            </Columns>
                                                                        </asp:GridView>
                                                                    </div>
                                                                </td>
                                                            </tr>
                                                        </ItemTemplate>
                                                    </asp:TemplateField>
                                                </Columns>
                                                <EditRowStyle BackColor="#999999" />
                                                <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                                                <HeaderStyle BackColor="White" Font-Bold="True" ForeColor="White" />
                                                <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
                                                <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
                                                <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
                                                <SortedAscendingCellStyle BackColor="#E9E7E2" />
                                                <SortedAscendingHeaderStyle BackColor="#506C8C" />
                                                <SortedDescendingCellStyle BackColor="#FFFDF8" />
                                                <SortedDescendingHeaderStyle BackColor="#6F8DAE" />
                                            </asp:GridView>
                                        </caption>
                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </ContentTemplate>
    </asp:UpdatePanel>
    <asp:UpdateProgress ID="UpdateProgress" runat="server" AssociatedUpdatePanelID="Upanel">
        <ProgressTemplate>
            <div class="overlay">
                <%--  <div style="z-index: 1000; margin-left: 450px; margin-top: 0; opacity: 1; -moz-opacity: 1;">--%>
                <div class="LoadingDivCss">
                    <img alt="" src="IMG/Spinner.gif" class="LoadingImgCss" />
                </div>
            </div>
        </ProgressTemplate>
    </asp:UpdateProgress>


<script src="https://code.jquery.com/jquery-3.7.0.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css?v=1.1" rel="stylesheet" />
 <!-- Bootstrap 5 -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet" />
<!-- Optional Bootstrap Icons -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.5/font/bootstrap-icons.css" rel="stylesheet" />

</asp:Content>
