Invoice Layout
Invoice Layout
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.
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 (America) Inc.
Hot Sauce Depot
Re: Invoice Layout
Got one! To add the payment method:
Open Admin/Orders/Print/Invoices.ascx.cs
Add
to the top section of code (such as below using CommerceBuilder.Orders;)
Add the following code
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.
Open Admin/Orders/Print/Invoices.ascx.cs
Add
Code: Select all
using CommerceBuilder.Payments;
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());
}
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 (America) Inc.
Hot Sauce Depot
Re: Invoice Layout
To add the phone number and shipping method to the Ship To block:
Replace
with
Replace
Code: Select all
string shipTo = shipment.FormatToAddress();
if (!addressList.Contains(shipTo)) addressList.Add(shipTo)
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 (America) Inc.
Hot Sauce Depot
Re: Invoice Layout
To remove shipping as a line item find the following code in Admin/Orders/Print/Invoices.ascx.cs
Remove:
OrderItemType.Shipping
Shipping will still display below Subtotal
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};
OrderItemType.Shipping
Shipping will still display below Subtotal
Rick Morris
Brewhaus (America) Inc.
Hot Sauce Depot
Brewhaus (America) Inc.
Hot Sauce Depot
Re: Invoice Layout
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
Brewhaus (America) Inc.
Hot Sauce Depot
-
- Commodore (COMO)
- Posts: 436
- Joined: Tue May 07, 2013 1:59 pm
Re: Invoice Layout
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.
You can adjust the FindAll predicate if you want to show other types of notes, such as
You could also add a column with the date, so your columns become:
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).
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>
Code: Select all
.FindAll(on => on.NoteType == NoteType.Public || on.NoteType == NoteType.SystemPublic)
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>
Jay
-
- Commodore (COMO)
- Posts: 436
- Joined: Tue May 07, 2013 1:59 pm
Re: Invoice Layout
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
Re: Invoice Layout
That first code did the trick. Thank you!
Rick Morris
Brewhaus (America) Inc.
Hot Sauce Depot
Brewhaus (America) Inc.
Hot Sauce Depot
- compunerdy
- Admiral (ADM)
- Posts: 1283
- Joined: Sun Nov 18, 2007 3:55 pm
Re: Invoice Layout
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?
Re: Invoice Layout
I am not sure if this is what you are looking for, but hopefully it helps.
Rick Morris
Brewhaus (America) Inc.
Hot Sauce Depot
Brewhaus (America) Inc.
Hot Sauce Depot
- compunerdy
- Admiral (ADM)
- Posts: 1283
- Joined: Sun Nov 18, 2007 3:55 pm
Re: Invoice Layout
I figured it out..
I added OrderItemType.Discount to the adjustments function and removed it from the subtotal and it all looks good now.
I added OrderItemType.Discount to the adjustments function and removed it from the subtotal and it all looks good now.
- compunerdy
- Admiral (ADM)
- Posts: 1283
- Joined: Sun Nov 18, 2007 3:55 pm
Re: Invoice Layout
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.
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.
Re: Invoice Layout Show Payment and balance
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?
I had GetTotalPayment and GetBalance references and Gold does not have these. Has anyone else done this?
-
- Commodore (COMO)
- Posts: 436
- Joined: Tue May 07, 2013 1:59 pm
Re: Invoice Layout Show Payment and balance
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).vsammons wrote:I had GetTotalPayment and GetBalance references and Gold does not have these. Has anyone else done this?
Jay
Re: Invoice Layout Show Payment and balance
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 wrote: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).vsammons wrote:I had GetTotalPayment and GetBalance references and Gold does not have these. Has anyone else done this?
-
- Commodore (COMO)
- Posts: 436
- Joined: Tue May 07, 2013 1:59 pm
Re: Invoice Layout
Not sure why it wouldn't show up in IntelliSense. Make sure you have "use CommerceBuilder.Orders;" and "use CommerceBuilder.Payments;".
Jay
Re: Invoice Layout
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?
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?
-
- Commodore (COMO)
- Posts: 436
- Joined: Tue May 07, 2013 1:59 pm
Re: Invoice Layout
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
-
- Commodore (COMO)
- Posts: 436
- Joined: Tue May 07, 2013 1:59 pm
Re: Invoice Layout
I do see it! Thanksjguengerich wrote:This is what I see in R10: