Page 1 of 1

Admin Taxes Report Totals

Posted: Mon Nov 10, 2008 1:08 pm
by William_firefold
On our taxes report, we need a summary of all taxes for a certain period.
I have been trying to do it myself, but it is not built the same way as dailysales, and I cant seem to get it to work.
This could either be a footer template or just a label on the page containing the total amount of taxes for the given period.
We dont need to be limited to 20 records per page, all of them could be listed if needed, the total is what we want here.
Currently we have someone add them up manually, and that wont do at all.

Re: Admin Taxes Report Totals

Posted: Tue Nov 11, 2008 9:16 am
by mazhar
Add following method and fields to the tax report

Code: Select all

 protected LSDecimal _totalTax;
    protected string _totalTaxMessage = "Total Tax: {0}";
    protected void TaxesGrid_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            OrderItem orderItem = (OrderItem)e.Row.DataItem;
            _totalTax += orderItem.ExtendedPrice;
            TotalTaxLabel.Text = String.Format(_totalTaxMessage, _totalTax);
        }
    }
and then place following label in the report somewhere at bottom.

Code: Select all

<asp:Label ID="TotalTaxLabel" runat="server" ></asp:Label>
Finally attach the TaxesGrid_RowDataBound event handler to the gridview as below

Code: Select all

<cb:SortedGridView ID="TaxesGrid" runat="server" AutoGenerateColumns="False" Width="100%"
                            AllowPaging="True" PageSize="20" SkinID="Summary" DataSourceId="TaxesDs" OnRowDataBound="TaxesGrid_RowDataBound" >

Re: Admin Taxes Report Totals

Posted: Wed Nov 12, 2008 8:02 am
by William_firefold
Thanks, this will help our accounting dept a lot.

It may be worth noting that this tabulates total tax on the page, not for the time period.

Re: Admin Taxes Report Totals

Posted: Wed Nov 12, 2008 8:12 am
by mazhar
One more thing, you have to remove the paging form the gridview, for this just set AllowPaging="false" on the gridview.