Adding Payment Reference on Packing Slip and Invoice

For general questions and discussions specific to the AbleCommerce 7.0 Asp.Net product.
Post Reply
User avatar
bha
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 44
Joined: Tue Mar 11, 2008 6:04 pm

Adding Payment Reference on Packing Slip and Invoice

Post by bha » Wed Apr 02, 2008 10:09 pm

I've searched the forum and having no luck on finding information on how to add a payment reference (such as Purchase Order) on the packing slip and the invoice.

I looked at an example in vieworder.aspx and myorder.aspx but not quite sure how to use it in the packinglist.aspx.

The P.O. reference is mandatory for many accounting systems to close the loop.

Can a kind soul suggest a hint? :)

Thanks,
Bruce.

User avatar
jmestep
AbleCommerce Angel
Posts: 8164
Joined: Sun Feb 29, 2004 8:04 pm
Location: Dayton, OH
Contact:

Re: Adding Payment Reference on Packing Slip and Invoice

Post by jmestep » Thu Apr 03, 2008 7:56 am

You might be able to get it from the help site by looking at nVelocity reference-- that is what you can use to get at different variables. Sorry, I don't have the link to give you.
Judy Estep
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx

User avatar
bha
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 44
Joined: Tue Mar 11, 2008 6:04 pm

Re: Adding Payment Reference on Packing Slip and Invoice

Post by bha » Thu Apr 03, 2008 8:12 am

OK I found a way to do it and thought I would share to whom it may concern. I am using a hosted solution so I do not have direct access to the datasource. I have to study to output code and modify that to do what I need, make the change locally, post it back on the server and then test it. Not exactly ideal unless someone can suggest a better way. Suggestions would help anyone trying to customize using a hosted solution.

Anyhow here is what I did to get the PO to show on my packing list.

In the PackingList.aspx there is no code behind to bind the data to read. It is included in the <script> section.

In this section, there is a reference to the OrderID via myorder=_OrderShipment.Order. In other words, myorder.OrderID is the reference to the order number (OrderID) for that shipment.

I use the repeater control to bind the data source to payment:

Code: Select all

PaymentRepeater.DataSource = myOrder.Payments;
PaymentRepeater.DataBind();
This will be used in the <asp:> flag in the location you want to display the PO:

Code: Select all

<asp:Repeater ID="PaymentRepeater" runat="server">
   <ItemTemplate>
      <asp:Label ID="PaymentMethodName" runat="server" Text='<%#Eval("PaymentMethodName")%>'></asp:Label>
      <asp:Label ID="ReferenceNumber" runat="server" Text='<%#Eval("ReferenceNumber")%>'></asp:Label><br />
   </ItemTemplate>
</asp:Repeater>
And voila! My payment info and reference are now shown in a cell in the packing list. My customers require this and now they will have it.

User avatar
bha
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 44
Joined: Tue Mar 11, 2008 6:04 pm

Re: Adding Payment Reference on Packing Slip and Invoice

Post by bha » Sat Apr 05, 2008 6:59 pm

Well, it has been brought to my attention that there are two places for printing packing slips and invoices. The code mods were for the PackingList.aspx page under /Orders/Shipments.

The code mods above would not work for printing of the PackSlips.aspx and Invoices.aspx under /Orders/Printing. Since the pages under /Printing uses a repeater control to print multiple orders, the previous repeater control cannot be embedded within another repeater.

I used a formview control and associated DataSource member to hook into the Payments table to get to the payment reference. This technique works on both the PackSlips.aspx and Invoices.aspx. Would love to see the database schema if anyone has the map.

1st add the following between the <script> </script> section:

Code: Select all

protected PaymentCollection GetPayments(int orderId)
    {
		Order order = OrderDataSource.Load(orderId);
        return order.Payments;
	}	
Then in the form where you want the payment reference to be, add:

Code: Select all

                   
                            <asp:formview 
                                runat="server"
                                HorizontalAlign="left" 
                                id="paymentref_fv" 
                                DataSource='<%#GetPayments(Convert.ToInt32(Eval("OrderId")))%>' 
                            >
                            	<ItemTemplate>
									<asp:Label ID="PaymentMethodLabel" runat="server" Text="Ref: " SkinID="FieldHeader"></asp:Label>
                                    <asp:Label ID="PaymentMethodName" runat="server" Text='<%#Eval("PaymentMethodName")%>'></asp:Label>
					                <asp:Label ID="ReferenceNumber" runat="server" Text='<%#Eval("ReferenceNumber")%>'></asp:Label> 
								</ItemTemplate>
		                    </asp:formview>
Basically I passed the "OrderID" value to load the OrderDataSource and then use that as the DataSource to then pull out the PaymentMethodName and ReferenceNumber.

If anyone has a better way, let me know! I'm still learning...

Post Reply