Invoice Layout

For general questions and discussions specific to the AbleCommerce GOLD ASP.Net shopping cart software.
Post Reply
Brewhaus
Vice Admiral (VADM)
Vice Admiral (VADM)
Posts: 878
Joined: Sat Jan 19, 2008 4:30 pm

Invoice Layout

Post by Brewhaus » Wed Jul 17, 2013 6:48 pm

We are trying to build the same invoice layout that we use in 7.0.7, but when we try to make the same changes to the files in Gold we get errors. This was covered in viewtopic.php?f=42&t=15747 for version 7.0.7, but I thought that it would be best to start this thread under Gold Discussions so that others trying to make invoice layout changes in Gold will be able to find the information.

In short, here are the things that we need changed in the invoice layout:

1) Remove shipping as a line item (it causes confusion to have it listed, but not included in the subtotal, and then listed again below the subtotal). We want it only included below the subtotal
2) Add the shipping method below the Ship To information
3) Add the payment type (Visa, PayPal, etc.) below the order number and order date
4) Add notes to invoice
I have found solutions to 1,2, and 3 (notes below), but cannot seem to get #4- can anyone help with this?

I will continue to work on these, and if I have any success I will list it to help others. If anyone can help with these changes, it would be greatly appreciated.
Last edited by Brewhaus on Wed Jul 17, 2013 8:07 pm, edited 1 time in total.
Rick Morris
Brewhaus (America) Inc.
Hot Sauce Depot

Brewhaus
Vice Admiral (VADM)
Vice Admiral (VADM)
Posts: 878
Joined: Sat Jan 19, 2008 4:30 pm

Re: Invoice Layout

Post by Brewhaus » Wed Jul 17, 2013 7:13 pm

Got one! To add the payment method:

Open Admin/Orders/Print/Invoices.ascx.cs
Add

Code: Select all

using CommerceBuilder.Payments;
to the top section of code (such as below using CommerceBuilder.Orders;)

Add the following code

Code: Select all

        protected string GetPaymentMethods(Object dataItem)
        {
            Order order = (Order)dataItem;
            List<string> paymentMethodNames = new List<string>();
            foreach (Payment payment in order.Payments)
            {
                if (!paymentMethodNames.Contains(payment.PaymentMethodName))
                    paymentMethodNames.Add(payment.PaymentMethodName);
            }

            return String.Join("", paymentMethodNames.ToArray());
        }
to the bottom of the file, before the second last }

Open Admin/Orders/Print/Invoices.ascx and locate the following line of code:
<asp:Label ID="OrderDate" runat="server" Text='<%# Eval("OrderDate", "{0:g}") %>'></asp:Label><br />

Below it add:
<asp:Label ID="PaymentMethodLabel" runat="server" Text="Paid By: " SkinID="FieldHeader"></asp:Label>
<%#GetPaymentMethods(Container.DataItem) %>

I think that is it. :-)
Last edited by Brewhaus on Wed Jul 17, 2013 7:34 pm, edited 2 times in total.
Rick Morris
Brewhaus (America) Inc.
Hot Sauce Depot

Brewhaus
Vice Admiral (VADM)
Vice Admiral (VADM)
Posts: 878
Joined: Sat Jan 19, 2008 4:30 pm

Re: Invoice Layout

Post by Brewhaus » Wed Jul 17, 2013 7:24 pm

To add the phone number and shipping method to the Ship To block:

Replace

Code: Select all

                string shipTo = shipment.FormatToAddress();
                if (!addressList.Contains(shipTo)) addressList.Add(shipTo)
with

Code: Select all

                string shipTo = shipment.FormatToAddress();
                string shipToPhone = string.Empty;
                if (!String.IsNullOrEmpty(shipment.ShipToPhone))
                    shipTo += "<br />" + shipment.ShipToPhone;
                shipTo += "<br /><br /><b>Ship By: </b>" + shipment.ShipMethodName;
                if (!string.IsNullOrEmpty(shipment.ShipMessage))
                    shipTo += "<br /><b>Shipping Note: </b>" + shipment.ShipMessage;
                if (!addressList.Contains(shipTo)) addressList.Add(shipTo);
Rick Morris
Brewhaus (America) Inc.
Hot Sauce Depot

Brewhaus
Vice Admiral (VADM)
Vice Admiral (VADM)
Posts: 878
Joined: Sat Jan 19, 2008 4:30 pm

Re: Invoice Layout

Post by Brewhaus » Wed Jul 17, 2013 7:50 pm

To remove shipping as a line item find the following code in Admin/Orders/Print/Invoices.ascx.cs

Code: Select all

        private OrderItemType[] displayItemTypes = { OrderItemType.Product, OrderItemType.Discount, 
        OrderItemType.Coupon, OrderItemType.Shipping, OrderItemType.Handling, OrderItemType.GiftWrap,
        OrderItemType.Charge, OrderItemType.Credit, OrderItemType.GiftCertificate, OrderItemType.Tax};
Remove:
OrderItemType.Shipping

Shipping will still display below Subtotal
Rick Morris
Brewhaus (America) Inc.
Hot Sauce Depot

Brewhaus
Vice Admiral (VADM)
Vice Admiral (VADM)
Posts: 878
Joined: Sat Jan 19, 2008 4:30 pm

Re: Invoice Layout

Post by Brewhaus » Mon Jul 22, 2013 11:14 am

We are still not able to get the order notes to print on the invoice. Can anyone help with this?
Rick Morris
Brewhaus (America) Inc.
Hot Sauce Depot

jguengerich
Commodore (COMO)
Commodore (COMO)
Posts: 436
Joined: Tue May 07, 2013 1:59 pm

Re: Invoice Layout

Post by jguengerich » Tue Jul 23, 2013 8:33 am

You could put something like this just before the last line that says </table> at the bottom of the Admin/Orders/Print/Invoices.ascx file.

Code: Select all

<tr>
    <td colspan="4" class="dataSheet">
        <asp:GridView ID="OrderNotes" runat="server" ShowHeader="true"
            AutoGenerateColumns="false" CellPadding="0" CellSpacing="0" GridLines="none" 
            Width="100%" DataSource='<%#((Order)Container.DataItem).Notes.FindAll(on => on.NoteType == NoteType.Public)%>' SkinID="PrintableList" >
            <Columns>
                <asp:BoundField DataField="Comment" HeaderText="Notes" ItemStyle-HorizontalAlign="Left" />
            </Columns>
        </asp:GridView>
    </td>
</tr>
You can adjust the FindAll predicate if you want to show other types of notes, such as

Code: Select all

.FindAll(on => on.NoteType == NoteType.Public || on.NoteType == NoteType.SystemPublic)
You could also add a column with the date, so your columns become:

Code: Select all

<Columns>
    <asp:BoundField DataField="CreatedDate" HeaderText="Date" ItemStyle-HorizontalAlign="Left" HeaderStyle-HorizontalAlign="Left" HeaderStyle-Width="15%" />
    <asp:BoundField DataField="Comment" HeaderText="Note" ItemStyle-HorizontalAlign="Left" HeaderStyle-HorizontalAlign="Left" />
</Columns>
You may need to adjust the HeaderStyle-Width setting if long CreatedDates are getting cut off (i.e. 12/31/2013 12:37:22 AM).
Jay

jguengerich
Commodore (COMO)
Commodore (COMO)
Posts: 436
Joined: Tue May 07, 2013 1:59 pm

Re: Invoice Layout

Post by jguengerich » Tue Jul 23, 2013 8:59 am

I just realized the printed version width is quite a bit different (at least for me), but the CreatedDate does wrap to the next line. You could also switch to pixels instead of percent for the HeaderStyle-Width if it helps you get the look you want.

Code: Select all

HeaderStyle-Width="125px"
Jay

Brewhaus
Vice Admiral (VADM)
Vice Admiral (VADM)
Posts: 878
Joined: Sat Jan 19, 2008 4:30 pm

Re: Invoice Layout

Post by Brewhaus » Tue Jul 23, 2013 11:59 am

That first code did the trick. Thank you! :-)
Rick Morris
Brewhaus (America) Inc.
Hot Sauce Depot

User avatar
compunerdy
Admiral (ADM)
Admiral (ADM)
Posts: 1283
Joined: Sun Nov 18, 2007 3:55 pm

Re: Invoice Layout

Post by compunerdy » Tue Oct 27, 2015 7:27 am

I figured out how to remove discounts on each line but how do I add it back in as a single line item or put it down near the subtotal?

Brewhaus
Vice Admiral (VADM)
Vice Admiral (VADM)
Posts: 878
Joined: Sat Jan 19, 2008 4:30 pm

Re: Invoice Layout

Post by Brewhaus » Tue Oct 27, 2015 7:37 am

I am not sure if this is what you are looking for, but hopefully it helps.
Rick Morris
Brewhaus (America) Inc.
Hot Sauce Depot

User avatar
compunerdy
Admiral (ADM)
Admiral (ADM)
Posts: 1283
Joined: Sun Nov 18, 2007 3:55 pm

Re: Invoice Layout

Post by compunerdy » Tue Oct 27, 2015 7:43 am

I figured it out..

I added OrderItemType.Discount to the adjustments function and removed it from the subtotal and it all looks good now.

User avatar
compunerdy
Admiral (ADM)
Admiral (ADM)
Posts: 1283
Joined: Sun Nov 18, 2007 3:55 pm

Re: Invoice Layout

Post by compunerdy » Tue Oct 27, 2015 8:30 am

Not sure if you did this or not but do you know how to get the product line item to display the price after discounts?

I thought what I did before would work fine but it would be easier to have the correct price per line item for doing customs forms.

User avatar
vsammons
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 33
Joined: Mon May 10, 2010 7:10 am

Re: Invoice Layout Show Payment and balance

Post by vsammons » Tue Oct 27, 2015 6:48 pm

Has anyone modified the Invoices to show the amount paid and current balance? I had this function in 7.x but the Gold does not have this. Our customers like to see that there is a ZERO balance after it is paid on the invoice.

I had GetTotalPayment and GetBalance references and Gold does not have these. Has anyone else done this?

jguengerich
Commodore (COMO)
Commodore (COMO)
Posts: 436
Joined: Tue May 07, 2013 1:59 pm

Re: Invoice Layout Show Payment and balance

Post by jguengerich » Wed Oct 28, 2015 4:09 am

vsammons wrote:I had GetTotalPayment and GetBalance references and Gold does not have these. Has anyone else done this?
Gold has GetBalance() and GetCustomerBalance() (methods of the Order class). For payments, there's the TotalPayments property or Order, or you could use order.Payments.Total() (can pass a bool indicating if pending payments should be included).
Jay

User avatar
vsammons
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 33
Joined: Mon May 10, 2010 7:10 am

Re: Invoice Layout Show Payment and balance

Post by vsammons » Wed Oct 28, 2015 4:15 am

jguengerich wrote:
vsammons wrote:I had GetTotalPayment and GetBalance references and Gold does not have these. Has anyone else done this?
Gold has GetBalance() and GetCustomerBalance() (methods of the Order class). For payments, there's the TotalPayments property or Order, or you could use order.Payments.Total() (can pass a bool indicating if pending payments should be included).
I was not able to find this in the Intellisence within the Visual Studio environment. I will give it another try. Do you have a sample/snipet I can use?

jguengerich
Commodore (COMO)
Commodore (COMO)
Posts: 436
Joined: Tue May 07, 2013 1:59 pm

Re: Invoice Layout

Post by jguengerich » Wed Oct 28, 2015 4:20 am

Not sure why it wouldn't show up in IntelliSense. Make sure you have "use CommerceBuilder.Orders;" and "use CommerceBuilder.Payments;".
Jay

User avatar
vsammons
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 33
Joined: Mon May 10, 2010 7:10 am

Re: Invoice Layout

Post by vsammons » Wed Oct 28, 2015 4:26 am

Negative...

I have using CommerceBuilder.Payments and using CommerceBuilder.Orders in references but still not coming up in the intellisense when typing Get... Are your 100% certain it is in Gold 10 version?

jguengerich
Commodore (COMO)
Commodore (COMO)
Posts: 436
Joined: Tue May 07, 2013 1:59 pm

Re: Invoice Layout

Post by jguengerich » Wed Oct 28, 2015 4:38 am

Yes, when I open the unmodified WSP or WAP project for R10, IntelliSense shows it (I'm on R5, and it is there too). It is listed in the .chm files for R10 and R11. The .chm file should be available in the downloads area when you log in to AbleCommerce's web site. For R10 it is called "CommerceBuilder Help File for AbleCommerce Gold". For R11 it is called "CommerceBuilder Source API Gold R11".
Jay

jguengerich
Commodore (COMO)
Commodore (COMO)
Posts: 436
Joined: Tue May 07, 2013 1:59 pm

Re: Invoice Layout

Post by jguengerich » Wed Oct 28, 2015 4:50 am

This is what I see in R10:
ISense.png
Jay

User avatar
vsammons
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 33
Joined: Mon May 10, 2010 7:10 am

Re: Invoice Layout

Post by vsammons » Wed Oct 28, 2015 5:01 am

jguengerich wrote:This is what I see in R10:
ISense.png
I do see it! Thanks

Post Reply