Admin Taxes Report Totals

For general questions and discussions specific to the AbleCommerce 7.0 Asp.Net product.
Post Reply
User avatar
William_firefold
Commander (CMDR)
Commander (CMDR)
Posts: 186
Joined: Fri Aug 01, 2008 8:38 am

Admin Taxes Report Totals

Post by William_firefold » Mon Nov 10, 2008 1:08 pm

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.

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: Admin Taxes Report Totals

Post by mazhar » Tue Nov 11, 2008 9:16 am

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" >

User avatar
William_firefold
Commander (CMDR)
Commander (CMDR)
Posts: 186
Joined: Fri Aug 01, 2008 8:38 am

Re: Admin Taxes Report Totals

Post by William_firefold » Wed Nov 12, 2008 8:02 am

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.

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: Admin Taxes Report Totals

Post by mazhar » Wed Nov 12, 2008 8:12 am

One more thing, you have to remove the paging form the gridview, for this just set AllowPaging="false" on the gridview.

Post Reply