Making Misc Charges show on AC7 Invoice

This forum is where we'll mirror posts that are of value to the community so they may be more easily found.
Post Reply
User avatar
AbleMods
Master Yoda
Master Yoda
Posts: 5170
Joined: Wed Sep 26, 2007 5:47 am
Location: Fort Myers, Florida USA

Making Misc Charges show on AC7 Invoice

Post by AbleMods » Tue May 13, 2008 3:25 pm

Just a quick modification today, so here goes:

The default AC7 invoice doesn't show credits, discounts, extra charges etc. It has the programming to do so, but the code doesn't work like it should. If you've ever added an extra line item for a Discount and then printed the invoice, you'll see what I mean.

Here's how to fix it so the line shows every time. As I said, this is a quick fix (I was in a hurry today) so the "Other:" charge line will show on every invoice whether it has a zero amount or not. Perhaps when I have more time I can make it fully functional as Able intended.

Edit the ~/Admin/Orders/Print/Invoices.aspx page and find this line:

Code: Select all

                            <tr id="trOther" runat="server" visible='<%# GetTotal(Container.DataItem, OrderItemType.Charge, OrderItemType.Coupon, OrderItemType.Credit, OrderItemType.Discount, OrderItemType.GiftCertificate, OrderItemType.GiftWrap) > 0) %>'  >
And remove the entire visible= parameter so the line looks like this:

Code: Select all

                            <tr id="trOther" runat="server" > 
Now go display an invoice for an order. You should see a line for "Other:" and it will contain the proper dollars for any discounts, coupons, additional charges etc that are part of the order line items.
Joe Payne
AbleCommerce Custom Programming and Modules http://www.AbleMods.com/
AbleCommerce Hosting http://www.AbleModsHosting.com/
Precise Fishing and Hunting Time Tables http://www.Solunar.com

User avatar
hassonmike
Lieutenant (LT)
Lieutenant (LT)
Posts: 76
Joined: Tue Apr 19, 2011 2:13 pm
Contact:

Re: Making Misc Charges show on AC7 Invoice

Post by hassonmike » Wed Sep 28, 2011 11:55 am

I am trying to do something like this for my invoices. We would like OrderItemType.Charge to display with a description of the charge (right with the rest of the items in the invoice).

Our code for our invoices does not contain the lines above, so im wondering if there is another way to acheive this?

Our invoices.aspx looks like:

Code: Select all

<%@ Page Language="C#" MasterPageFile="~/Admin/Admin.master" CodeFile="Invoices.aspx.cs" Inherits="Admin_Orders_Print_Invoices" Title="Invoices" %>
<%@ Register Src="../../UserControls/OrderItemDetail.ascx" TagName="OrderItemDetail" TagPrefix="uc" %>

<script runat="server">

protected string GetShipMethods(Object dataItem)
    {
        Order order = (Order)dataItem;
        string shippingMethods = string.Empty;
        foreach (OrderShipment orderShipment in order.Shipments)
        {
            shippingMethods += orderShipment.ShipMethod.Name;
            shippingMethods += ",";
        }
        if (!String.IsNullOrEmpty(shippingMethods))
            shippingMethods = shippingMethods.Remove((shippingMethods.Length - 1), 1);
        return shippingMethods;
    }


protected OrderNoteCollection GetOrderNotes(Object dataItem)
    {
        OrderNoteCollection orderNotes = new OrderNoteCollection();

        Order order = (Order)dataItem;
        if (order != null)
        {
            if (order.Notes != null && order.Notes.Count > 0)
            {
                foreach (OrderNote on in order.Notes)
                    if(!on.IsPrivate)
                    orderNotes.Add(on);
            }
        }
        
        return orderNotes;
    }


</script>













<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" Runat="Server">
    <div class="pageHeader noPrint">
        <div class="caption">
            <h1><asp:Localize ID="Caption" runat="server" Text="Invoices"></asp:Localize></h1>
        </div>
        <div class="content">
            <h2><asp:Localize ID="OrderListLabel" runat="server" Text="Includes Order Numbers:"></asp:Localize></h2>
            <asp:Label ID="OrderList" runat="server" Text=""></asp:Label><br />
            <p><asp:Localize ID="PrintInstructions" runat="server" Text="This document includes a printable stylesheet. The latest versions of IE and Firefox browsers will print with appropriate styles and page breaks if needed. Website headers, footers, and this message will not be printed."></asp:Localize></p>
        </div>
    </div>
    <div class="noPrint">
        <asp:Button ID="Print" runat="server" Text="Print" OnClientClick="window.print();return false;" />
        <asp:Button ID="Back" runat="server" Text="Back" OnClientClick="window.history.go(-1);return false;" />
    </div>
    <asp:Repeater ID="OrderRepeater" runat="server">
        <ItemTemplate>
            <table align="center" class="form<%# (Container.ItemIndex < (OrderCount - 1)) ? " breakAfter" : string.Empty %>" cellpadding="0" cellspacing="0" border="1">
                <tr>
                    <td colspan="4" valign="middle">
                        <div style="float:left">
                            <br />
							<span class="inlineCaption" style="font-size:150%;"><%#Token.Instance.Store.Name%></span>
							<br />
                            <%# Token.Instance.Store.DefaultWarehouse.FormatAddress(true) %>
                        </div>
                        <div style="float:right">
                            <h1 class="invoice">INVOICE</h1>
                            <asp:Label ID="OrderNumberLabel" runat="server" Text="Order Number:" SkinID="FieldHeader"></asp:Label>
                            <asp:Label ID="OrderNumber" runat="server" Text='<%# Eval("OrderNumber") %>'></asp:Label><br />
                            <asp:Label ID="OrderDateLabel" runat="server" Text="Order Date:" SkinID="FieldHeader"></asp:Label>
                            <asp:Label ID="OrderDate" runat="server" Text='<%# Eval("OrderDate", "{0:g}") %>'></asp:Label><br />
                            <asp:Label ID="ShippingMethodsLabel" runat="server" SkinID="FieldHeader" Text="Shipping Method: "></asp:Label>
                            <asp:Label ID="ShippingMethods" runat="server" Text='<%# GetShipMethods(Container.DataItem) %>'></asp:Label>
                        </div>
                    </td>
                </tr>
                <tr>
                    <td style="width:10px;text-align:center;font-weight:bold" valign="top">
                        S O L D &nbsp; T O
                    </td>
                    <td valign="middle" width="50%">
                        <%# GetBillToAddress(Container.DataItem) %>
                        <br /><%# GetEmailPhone(Container.DataItem) %>
                    </td>
                    <td style="width:10px;text-align:center;font-weight:bold" valign="top">
                        S H I P &nbsp; T O
                    </td>
                    <td valign="middle" width="50%">
                        <%# GetShipToAddress(Container.DataItem) %>
                    </td>
                </tr>
                <tr>
                    <td colspan="4" class="dataSheet">
                        <asp:GridView ID="OrderItems" runat="server" ShowHeader="true"
                            AutoGenerateColumns="false" CellPadding=0 CellSpacing=0 GridLines="none" 
                            Width="100%" DataSource='<%#GetItems(Container.DataItem)%>' CssClass="dataSheet" OnDataBinding="OrderItems_DataBinding">
                            <Columns>
                                <asp:BoundField DataField="Quantity" HeaderText="Quantity" ItemStyle-HorizontalAlign="Center" />
                                <asp:TemplateField HeaderText="SKU">                                    
                                    <ItemStyle HorizontalAlign="Center"/>
                                    <ItemTemplate>
                                        <%#ProductHelper.GetSKU(Container.DataItem)%>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Tax">                                    
                                    <ItemStyle HorizontalAlign="Center" Width="40px" />
                                    <ItemTemplate>
                                        <%#TaxHelper.GetTaxRate(((OrderItem)Container.DataItem).Order, (OrderItem)Container.DataItem).ToString("0.#")%>%
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Item">
                                    <ItemTemplate>
                                        <uc:OrderItemDetail ID="OrderItemDetail1" runat="server" OrderItem='<%#(OrderItem)Container.DataItem%>' ShowAssets="False" LinkProducts="False" />
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Price">
                                    <ItemStyle HorizontalAlign="right" width="80px" />
                                    <ItemTemplate>
                                        <asp:Label ID="Price" runat="server" Text='<%#TaxHelper.GetInvoiceExtendedPrice(((OrderItem)Container.DataItem).Order, (OrderItem)Container.DataItem).ToString("lc")%>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                            </Columns>
                        </asp:GridView>
                        <br />                        
                        <table width="100%" cellpadding="0" cellspacing="0" class="dataSheet">
                            <tr>
                                <th align="right">
                                    <asp:Label ID="SubtotalLabel" runat="server" Text="Product Subtotal:" />
                                </th>
                                <td align="right" width="80px">
                                    <%# GetProductTotal(Container.DataItem).ToString("lc") %>
                                </td>
                            </tr>
                            <tr>
                                <th align="right">
                                    <asp:Label ID="ShippingTotalLabel" runat="server" Text="Shipping & Handling:" />
                                </th>
                                <td align="right" width="80px">
                                    <%# GetShippingTotal(Container.DataItem).ToString("lc") %>
                                </td>
                            </tr>
                            <tr>
                                <th align="right">
                                    <asp:Label ID="TaxTotalLabel" runat="server" Text="Taxes:" />
                                </th>
                                <td align="right" width="80px">
                                    <%# GetTotal(Container.DataItem, OrderItemType.Tax).ToString("lc") %>
                                </td>
                            </tr>
                            <tr id="trAdjustments" runat="server" visible='<%# ShowAdjustmentsRow(Container.DataItem) %>'>
                                <th align="right">
                                    <asp:Label ID="AdjustmentsLabel" runat="server" Text="Adjustments:" />
                                </th>
                                <td align="right" width="80px">
                                    <%# GetAdjustmentsTotal(Container.DataItem).ToString("lc")%>
                                </td>
                            </tr>
                            <tr class="totalRow">
                                <th align="right">
                                    <asp:Label ID="TotalLabel" runat="server" Text="Total:" />
                                </th>
                                <td align="right" width="80px">
                                    <%# GetTotal(Container.DataItem).ToString("lc") %>
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
                <tr >
                    <td colspan="4" valign="middle">
                        <asp:GridView ID="OrderNotesRepeater" runat="server" AutoGenerateColumns="false" CellPadding=0 CellSpacing=0 GridLines="none" CssClass="dataSheet" DataSource='<%# GetOrderNotes(Container.DataItem) %>' ShowHeader="true" Width="100%">
                        <HeaderStyle HorizontalAlign="Left" />
                            <Columns>
                                <asp:TemplateField HeaderText="Order Notes" >
                                    <ItemStyle Wrap="true" />
                                    <ItemTemplate>
                                        <asp:Label ID="CommentLabel" runat="server" Text='<%#Eval("Comment") %>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                            </Columns>
                        </asp:GridView>
                    </td>
                </tr>
            </table>
        </ItemTemplate>
    </asp:Repeater>
</asp:Content>

User avatar
hassonmike
Lieutenant (LT)
Lieutenant (LT)
Posts: 76
Joined: Tue Apr 19, 2011 2:13 pm
Contact:

Re: Making Misc Charges show on AC7 Invoice

Post by hassonmike » Wed Sep 28, 2011 12:04 pm

Also, the Confirmation Email would ideally also contain info to the extra CHARGE items (OrderItemType.Charge) in the order summary, and a line to display the "Adjustments" in the Order Totals section. Not sure how involved that would be, but we can take it one step at a time if it not so simple to do something like that.

Post Reply