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.
Admin Taxes Report Totals
- William_firefold
- Commander (CMDR)
- Posts: 186
- Joined: Fri Aug 01, 2008 8:38 am
Re: Admin Taxes Report Totals
Add following method and fields to the tax report
and then place following label in the report somewhere at bottom.
Finally attach the TaxesGrid_RowDataBound event handler to the gridview as below
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);
}
}
Code: Select all
<asp:Label ID="TotalTaxLabel" runat="server" ></asp:Label>
Code: Select all
<cb:SortedGridView ID="TaxesGrid" runat="server" AutoGenerateColumns="False" Width="100%"
AllowPaging="True" PageSize="20" SkinID="Summary" DataSourceId="TaxesDs" OnRowDataBound="TaxesGrid_RowDataBound" >
- William_firefold
- Commander (CMDR)
- Posts: 186
- Joined: Fri Aug 01, 2008 8:38 am
Re: Admin Taxes Report Totals
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.
It may be worth noting that this tabulates total tax on the page, not for the time period.
Re: Admin Taxes Report Totals
One more thing, you have to remove the paging form the gridview, for this just set AllowPaging="false" on the gridview.