Features- are these part of AC7 already?

Store UI, layout, design, look and feel; Discussion on the customer facing pages of your online store. Cascading Style Sheets, Themes, Scriptlets, NVelocity and the components in the ConLib directory.
User avatar
jmestep
AbleCommerce Angel
Posts: 8164
Joined: Sun Feb 29, 2004 8:04 pm
Location: Dayton, OH
Contact:

Re: Features- are these part of AC7 already?

Post by jmestep » Fri Dec 26, 2008 3:04 pm

It should or an adaptation of it should.
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
heinscott
Captain (CAPT)
Captain (CAPT)
Posts: 375
Joined: Thu May 01, 2008 12:37 pm

Re: Features- are these part of AC7 already?

Post by heinscott » Mon Dec 29, 2008 9:37 am

We also came from Volusion, and you're right... the back end is pretty nice. In order to make Able's admin side a bit easier to use, we ended up creating an import for tracking numbers for UPS that the warehouse staff can use. It basically just creates a shipment, assigns the tracking number, and marks the order as shipped based on a CSV file that is exported from our UPS software. We must be little girls, however, as it's written in C#... :)
I agree, also, that a one-page screen to process everything would be nice, too. We do a similar number of orders a day, however, and our warehouse guys have gotten used to the way AC is setup. Until they start complaining, I guess everything is fine there...

Scott

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

Re: Features- are these part of AC7 already?

Post by Brewhaus » Mon Dec 29, 2008 7:48 pm

Judy- where exactly would we place the code that you posted? I tried a couple of options that I thought would be appropriate, and received Runtime errors when trying to bring up an invoice for printing.
Rick Morris
Brewhaus (America) Inc.
Hot Sauce Depot

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

Re: Features- are these part of AC7 already?

Post by jmestep » Tue Dec 30, 2008 7:47 am

This is bad-- I went to check on the fine details of how to do it and found that I had actually done it in the past. On Admin/Orders/Print/Invoices.aspx add these:

Code: Select all

 /// <summary>
    /// Gets a collection of orders from a list of order ids.
    /// </summary>
    /// <param name="orderIds">The orderIds to load.</param>
    /// <returns>A collection of orders from the list of ids.</returns>
    protected OrderCollection GetOrders(params int[] orderIds)
    {
        OrderCollection orders = new OrderCollection();
        orderNumbers = new List<string>();
        foreach (int orderId in orderIds)
        {
            Order order = OrderDataSource.Load(orderId);
            if (order != null)
            {
                orderNumbers.Add(order.OrderId.ToString());
                orders.Add(order);
            }
        }
        OrderCount = orders.Count;
        return orders;
    }

<table align="center" class="form" cellpadding="0" cellspacing="0" border="1">
        <tr>
            <th>
                <asp:Label ID="OrderNotesCaption" runat="server" Text="ORDER NOTES"></asp:Label>
            </th>
        </tr>
        <tr>
            <td class="dataSheet">
                            <asp:GridView ID="OrderNotesGrid" runat="server" Width="100%" AutoGenerateColumns="false"
                DataSource='<%#GetPublicNotes(Container.DataItem)%>' GridLines="none" SkinID="ItemList">
                    <Columns>
                        <asp:TemplateField HeaderText="Date" ItemStyle-Wrap="false" HeaderStyle-HorizontalAlign="Left" ControlStyle-Width="130">
                            <ItemTemplate>
                                <asp:Label ID="CreatedDate" runat="server" Text='<%# Eval("CreatedDate") %>'></asp:Label><br />
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Comment" HeaderStyle-HorizontalAlign="Left" ControlStyle-Width="440">
                            <ItemTemplate>
                                <asp:Label ID="Comment" runat="server" Text='<%# Eval("Comment") %>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                    </Columns>
                </asp:GridView>
                
            </td>
        </tr>
    </table>
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

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

Re: Features- are these part of AC7 already?

Post by Brewhaus » Tue Dec 30, 2008 8:25 am

Where would these be placed in the Invoices file?
Rick Morris
Brewhaus (America) Inc.
Hot Sauce Depot

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

Re: Features- are these part of AC7 already?

Post by jmestep » Tue Dec 30, 2008 10:10 am

The first section would be place up in the top of the page where the other code is between the <script tags similar to the placing of the code block for private List<int> GetSelectedOrders()........

The section starting with the <table> tag could be wherever you want it to print- I had it print as last thing on the invoice.
Able didn't use conlib or code behind on the invoices.aspx .
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

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

Re: Features- are these part of AC7 already?

Post by Brewhaus » Tue Dec 30, 2008 6:47 pm

That is what I had done, but even the first section alone is causing a runtime error. It could be due to the customization of the Invoices.aspx file to include the shipping and payment method. Here is my current file, maybe someone can see the problem:

Code: Select all

<%@ Page Language="C#" MasterPageFile="~/Admin/Admin.master" Title="Invoices" Inherits="CommerceBuilder.Web.UI.AbleCommerceAdminPage" %>
<%@ Register Src="../../UserControls/OrderItemDetail.ascx" TagName="OrderItemDetail" TagPrefix="uc" %>

<script runat="server">
    private List<string> orderNumbers;
    protected int OrderCount = 0;
    
    private List<int> GetSelectedOrders()
    {
        //CHECK FOR QUERYSTRING PARAMETERS
        List<int> selectedOrders = new List<int>();
        string orderIdList = Request.QueryString["orders"];
        if (!string.IsNullOrEmpty(orderIdList))
        {
            string[] numberTokens = orderIdList.Split(",".ToCharArray());
            foreach (string numberToken in numberTokens)
            {
                int temp = AlwaysConvert.ToInt(numberToken);
                if (temp > 0) selectedOrders.Add(temp);
            }
        }
        return selectedOrders;
    }

    private string GetOrderNumbers(List<int> orders)
    {
        if (orderNumbers == null)
        {
            orderNumbers = new List<string>();
            foreach (int orderId in orders)
            {
                orderNumbers.Add(orderId.ToString());
            }
        }
        if (orderNumbers.Count == 0) return string.Empty;
        return string.Join(", ", orderNumbers.ToArray());
    }

    /// <summary>
    /// Gets a collection of orders from a list of order ids.
    /// </summary>
    /// <param name="orderIds">The orderIds to load.</param>
    /// <returns>A collection of orders from the list of ids.</returns>
    protected OrderCollection GetOrders(params int[] orderIds)
    {
        OrderCollection orders = new OrderCollection();
        orderNumbers = new List<string>();
        foreach (int orderId in orderIds)
        {
            Order order = OrderDataSource.Load(orderId);

         if (order != null)
            {
                orderNumbers.Add(order.OrderId.ToString());
                orders.Add(order);
            }
        }
        OrderCount = orders.Count;
        return orders;
    }

//BH080405 Create a new collection for Payments to access payment reference
    protected PaymentCollection GetPayments(int orderId)
    {
      Order order = OrderDataSource.Load(orderId);
        return order.Payments;
    }
    
    protected void Page_Load(object sender, EventArgs e)
    {
        List<int> selectedOrders = GetSelectedOrders();
        if ((selectedOrders == null) || (selectedOrders.Count == 0)) Response.Redirect("~/Admin/Orders/Default.aspx");
        OrderRepeater.DataSource = GetOrders(selectedOrders.ToArray());
        OrderRepeater.DataBind();
        OrderList.Text = GetOrderNumbers(selectedOrders);
    }

    protected void MarkPrinted_Click(object sender, EventArgs e)
    {
        List<int> selectedOrders = GetSelectedOrders();
        if ((selectedOrders == null) || (selectedOrders.Count == 0)) Response.Redirect("~/Admin/Orders/Default.aspx");
        OrderCollection orders = GetOrders(selectedOrders.ToArray());
        OrderStatus orderStatus = OrderStatusDataSource.Load(7,false);
        foreach (Order order in orders)
            order.UpdateOrderStatus(orderStatus);
    }


    protected OrderItemCollection GetProducts(object dataItem)
    {
        Order order = (Order)dataItem;
        OrderItemCollection products = new OrderItemCollection();
        foreach (OrderItem item in order.Items)
        {
            if (item.OrderItemType == OrderItemType.Product)
            {
                products.Add(item);
            }
        }
        products.Sort("Name");
        return products;
    }

    protected string GetBillToAddress(object dataItem)
    {
        return ((Order)dataItem).FormatAddress(true);
    }

    protected string GetShipToAddress(object dataItem)
    {
        Order order = (Order)dataItem;
        List<string> addressList = new List<string>();
        foreach (OrderShipment shipment in order.Shipments)
        {
            string shipTo = shipment.FormatToAddress();
            if (!addressList.Contains(shipTo)) addressList.Add(shipTo);
        }
        if (addressList.Count == 0) return "n/a";
        return string.Join("<hr />", addressList.ToArray());
    }
   
//BH080406  LOAD SHIPMETHOD NAME TO SHIPMENT
   protected string GetShippingMethod(object dataItem)
    {
        Order order = (Order)dataItem;
        List<string> shipmethodList = new List<string>();
        foreach (OrderShipment shipment in order.Shipments)
        {
            string shipmethod = shipment.ShipMethodName;
         shipmethodList.Add(shipmethod);
        }
        return string.Join("<hr/>", shipmethodList.ToArray());
    }
//////

//BH080406  LOAD SHIPMESSAGE TO SHIPMENT
   protected string GetShipMessage(object dataItem)
    {
        Order order = (Order)dataItem;
        List<string> shipmethodList = new List<string>();
        foreach (OrderShipment shipment in order.Shipments)
        {
            string shipmethod = shipment.ShipMessage;
         shipmethodList.Add(shipmethod);
        }
        return string.Join("<hr/>", shipmethodList.ToArray());
    }
//////


    protected LSDecimal GetTotal(object dataItem, params OrderItemType[] orderItems)
    {
        return ((Order)dataItem).Items.TotalPrice(orderItems);
    }

    protected LSDecimal GetTotalPayments(object dataItem)
    {
        return ((Order)dataItem).Payments.Total(true);
    }
    
    protected LSDecimal GetBalance(object dataItem)
    {
        return GetTotal(dataItem) - GetTotalPayments(dataItem);
    }
    
</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.  If you are using a modern browser (such as IE7, FF2, or Opera 7) this page 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 true;" OnClick="MarkPrinted_Click" />
        <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("OrderId") %>'></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 />
                        </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>
<asp:Label ID="Label1" runat="server" Text=""></asp:Label><%# Eval("BillToPhone") %><br>

<asp:formview 
                               runat="server"
                                HorizontalAlign="left" 
                                id="paymentref_fv" 
                                DataSource='<%#GetPayments(Convert.ToInt32(Eval("OrderId")))%>' 
                      >
                               <ItemTemplate>
               Paid by:
                                    <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>





                    </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) %><br><br>Ship by: <%# GetShippingMethod(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='<%#GetProducts(Container.DataItem)%>' CssClass="dataSheet">
                            <Columns>
                                <asp:BoundField DataField="Quantity" HeaderText="Quantity" ItemStyle-HorizontalAlign="Center" />
                                <asp:BoundField DataField="Sku" HeaderText="Sku" ItemStyle-HorizontalAlign="Center" />
                                <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='<%#Eval("ExtendedPrice", "{0:lc}")%>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                            </Columns>
                        </asp:GridView>
                        <table width="100%" cellpadding="0" cellspacing="0" class="dataSheet">
                            <tr>
                                <th align="right">
                                    <asp:Label ID="SubtotalLabel" runat="server" Text="Subtotal:" />
                                </th>
                                <td align="right" width="80px">
                                    <%# string.Format("{0:lc}", GetTotal(Container.DataItem, OrderItemType.Product)) %>
                                </td>
                            </tr>
                            <tr>
                                <th align="right">
                                    <asp:Label ID="ShippingTotalLabel" runat="server" Text="Shipping:" />
                                </th>
                                <td align="right" width="80px">
                                    <%# string.Format("{0:lc}", GetTotal(Container.DataItem, OrderItemType.Shipping, OrderItemType.Handling)) %>
                                </td>
                            </tr>
                            <tr>
                                <th align="right">
                                    <asp:Label ID="TaxTotalLabel" runat="server" Text="Tax:" />
                                </th>
                                <td align="right" width="80px">
                                    <%# string.Format("{0:lc}", GetTotal(Container.DataItem, OrderItemType.Tax)) %>
                                </td>
                            </tr>
                            <tr id="trOther" runat="server" visible='<%# GetTotal(Container.DataItem, OrderItemType.Charge, OrderItemType.Coupon, OrderItemType.Credit, OrderItemType.Discount, OrderItemType.GiftCertificate, OrderItemType.GiftWrap) > 0 %>'>
                                <th align="right">
                                    <asp:Label ID="OtherTotalLabel" runat="server" Text="Other:" />
                                </th>
                                <td align="right" width="80px">
                                    <%# string.Format("{0:lc}", GetTotal(Container.DataItem, OrderItemType.Charge, OrderItemType.Coupon, OrderItemType.Credit, OrderItemType.Discount, OrderItemType.GiftCertificate, OrderItemType.GiftWrap)) %>
                                </td>
                            </tr>
                            <tr class="totalRow">
                                <th align="right">
                                    <asp:Label ID="TotalLabel" runat="server" Text="Total:" />
                                </th>
                                <td align="right" width="80px">
                                    <%# string.Format("{0:lc}", GetTotal(Container.DataItem)) %>
                                </td>
                            </tr>
                            <%--
                            <tr>
                                <th align="right">
                                    <asp:Label ID="PaymentsLabel" runat="server" Text="Payments:" />
                                </th>
                                <td align="right" width="80px">
                                    <%# string.Format("{0:lc}", GetTotalPayments(Container.DataItem)) %>
                                </td>
                            </tr>
                            <tr>
                                <th align="right">
                                    <asp:Label ID="BalanceLabel" runat="server" Text="Balance:" />
                                </th>
                                <td align="right" width="80px">
                                    <%# string.Format("{0:lc}", GetBalance(Container.DataItem)) %>
                                </td>
                            </tr>
                            --%>
                        </table>
                    </td>
                </tr>
            </table>
        </ItemTemplate>
    </asp:Repeater>
</asp:Content>
Rick Morris
Brewhaus (America) Inc.
Hot Sauce Depot

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: Features- are these part of AC7 already?

Post by mazhar » Wed Dec 31, 2008 7:33 am

These comments appear to be different from the 'notes' added after the order is placed (in th add new notes box at the bottom of a given order). How can we make those notes show up on the order? We find people to be using that input to add order comments, and with the comments not showing on the invoice or packing slip, the people pulling the order can miss important information from the customer.
Are you taking about this
viewtopic.php?f=42&t=9146

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

Re: Features- are these part of AC7 already?

Post by Brewhaus » Thu Jan 01, 2009 10:55 am

I tried the code listed in the referenced thread and noted a couple of issues.

Ultimately, I have managed to make a couple of changes to our invoice, but still have a couple more to complete and have had no luck:

I would like to add the Ship To phone number. All that I have been able to do is list the Bill To phone number in the Ship To block. When I try to change the reference to ShipToPhone I get a Runtime error.

I would like to move the Paid By information to over the Ship By information. When I try to move the block that creates the information I again get a Runtime error.

We would like to add the Order Notes to the invoices, but need this information to be located on the correct invoices when printing the invoices in bulk from the Orders menu. The code in the referenced thread does print the notes on the order, but only if you print each order individually. If you print multiple orders via the Orders menu, all notes are placed on the last invoice in the set to be printed (if you print 10 invoices and there are notes on 3 of them, all three notes print on the last invoice).

Can anyone help on any of these problems? The code that we are using currently is as follows:

Code: Select all

<%@ Page Language="C#" MasterPageFile="~/Admin/Admin.master" Title="Invoices" Inherits="CommerceBuilder.Web.UI.AbleCommerceAdminPage" %>
<%@ Register Src="../../UserControls/OrderItemDetail.ascx" TagName="OrderItemDetail" TagPrefix="uc" %>

<script runat="server">
    private List<string> orderNumbers;
    protected int OrderCount = 0;
    
    private List<int> GetSelectedOrders()
    {
        //CHECK FOR QUERYSTRING PARAMETERS
        List<int> selectedOrders = new List<int>();
        string orderIdList = Request.QueryString["orders"];
        if (!string.IsNullOrEmpty(orderIdList))
        {
            string[] numberTokens = orderIdList.Split(",".ToCharArray());
            foreach (string numberToken in numberTokens)
            {
                int temp = AlwaysConvert.ToInt(numberToken);
                if (temp > 0) selectedOrders.Add(temp);
            }
        }
        return selectedOrders;
    }

    private string GetOrderNumbers(List<int> orders)
    {
        if (orderNumbers == null)
        {
            orderNumbers = new List<string>();
            foreach (int orderId in orders)
            {
                orderNumbers.Add(orderId.ToString());
            }
        }
        if (orderNumbers.Count == 0) return string.Empty;
        return string.Join(", ", orderNumbers.ToArray());
    }

    /// <summary>
    /// Gets a collection of orders from a list of order ids.
    /// </summary>
    /// <param name="orderIds">The orderIds to load.</param>
    /// <returns>A collection of orders from the list of ids.</returns>
    protected OrderCollection GetOrders(params int[] orderIds)
    {
        OrderCollection orders = new OrderCollection();
        orderNumbers = new List<string>();
        foreach (int orderId in orderIds)
        {
            Order order = OrderDataSource.Load(orderId);

         if (order != null)
            {
                orderNumbers.Add(order.OrderId.ToString());
                orders.Add(order);
            }
        }
        OrderCount = orders.Count;
        return orders;
    }

//BH080405 Create a new collection for Payments to access payment reference
    protected PaymentCollection GetPayments(int orderId)
    {
      Order order = OrderDataSource.Load(orderId);
        return order.Payments;
    }
    
    protected void Page_Load(object sender, EventArgs e)
    {
        List<int> selectedOrders = GetSelectedOrders();
        if ((selectedOrders == null) || (selectedOrders.Count == 0)) Response.Redirect("~/Admin/Orders/Default.aspx");
        OrderRepeater.DataSource = GetOrders(selectedOrders.ToArray());
        OrderRepeater.DataBind();
        OrderList.Text = GetOrderNumbers(selectedOrders);
    }

    protected void MarkPrinted_Click(object sender, EventArgs e)
    {
        List<int> selectedOrders = GetSelectedOrders();
        if ((selectedOrders == null) || (selectedOrders.Count == 0)) Response.Redirect("~/Admin/Orders/Default.aspx");
        OrderCollection orders = GetOrders(selectedOrders.ToArray());
        OrderStatus orderStatus = OrderStatusDataSource.Load(7,false);
        foreach (Order order in orders)
            order.UpdateOrderStatus(orderStatus);
    }


    protected OrderItemCollection GetProducts(object dataItem)
    {
        Order order = (Order)dataItem;
        OrderItemCollection products = new OrderItemCollection();
        foreach (OrderItem item in order.Items)
        {
            if (item.OrderItemType == OrderItemType.Product)
            {
                products.Add(item);
            }
        }
        products.Sort("Name");
        return products;
    }

    protected string GetBillToAddress(object dataItem)
    {
        return ((Order)dataItem).FormatAddress(true);
    }

    protected string GetShipToAddress(object dataItem)
    {
        Order order = (Order)dataItem;
        List<string> addressList = new List<string>();
        foreach (OrderShipment shipment in order.Shipments)
        {
            string shipTo = shipment.FormatToAddress();
            if (!addressList.Contains(shipTo)) addressList.Add(shipTo);
        }
        if (addressList.Count == 0) return "n/a";
        return string.Join("<hr />", addressList.ToArray());
    }
   
//BH080406  LOAD SHIPMETHOD NAME TO SHIPMENT
   protected string GetShippingMethod(object dataItem)
    {
        Order order = (Order)dataItem;
        List<string> shipmethodList = new List<string>();
        foreach (OrderShipment shipment in order.Shipments)
        {
            string shipmethod = shipment.ShipMethodName;
         shipmethodList.Add(shipmethod);
        }
        return string.Join("<hr/>", shipmethodList.ToArray());
    }
//////

//BH080406  LOAD SHIPMESSAGE TO SHIPMENT
   protected string GetShipMessage(object dataItem)
    {
        Order order = (Order)dataItem;
        List<string> shipmethodList = new List<string>();
        foreach (OrderShipment shipment in order.Shipments)
        {
            string shipmethod = shipment.ShipMessage;
         shipmethodList.Add(shipmethod);
        }
        return string.Join("<hr/>", shipmethodList.ToArray());
    }
//////


    protected LSDecimal GetTotal(object dataItem, params OrderItemType[] orderItems)
    {
        return ((Order)dataItem).Items.TotalPrice(orderItems);
    }

    protected LSDecimal GetTotalPayments(object dataItem)
    {
        return ((Order)dataItem).Payments.Total(true);
    }
    
    protected LSDecimal GetBalance(object dataItem)
    {
        return GetTotal(dataItem) - GetTotalPayments(dataItem);
    }
    
</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.  If you are using a modern browser (such as IE7, FF2, or Opera 7) this page 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 true;" OnClick="MarkPrinted_Click" />
        <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("OrderId") %>'></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 />

                        <br><b>Ship by: </b><%# GetShippingMethod(Container.DataItem) %>

                        </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>
<asp:Label ID="Label1" runat="server" Text=""></asp:Label><%# Eval("BillToPhone") %><br>

<asp:formview 
                               runat="server"
                                HorizontalAlign="left" 
                                id="paymentref_fv" 
                                DataSource='<%#GetPayments(Convert.ToInt32(Eval("OrderId")))%>' 
                      >
                               <ItemTemplate>
               Paid by:
                                    <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>





                    </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) %><br>
<asp:Label ID="Label2" runat="server" Text=""></asp:Label><%# Eval("BillToPhone") %><br>
                    </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='<%#GetProducts(Container.DataItem)%>' CssClass="dataSheet">
                            <Columns>
                                <asp:BoundField DataField="Quantity" HeaderText="Quantity" ItemStyle-HorizontalAlign="Center" />
                                <asp:BoundField DataField="Sku" HeaderText="Sku" ItemStyle-HorizontalAlign="Center" />
                                <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='<%#Eval("ExtendedPrice", "{0:lc}")%>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                            </Columns>
                        </asp:GridView>
                        <table width="100%" cellpadding="0" cellspacing="0" class="dataSheet">
                            <tr>
                                <th align="right">
                                    <asp:Label ID="SubtotalLabel" runat="server" Text="Subtotal:" />
                                </th>
                                <td align="right" width="80px">
                                    <%# string.Format("{0:lc}", GetTotal(Container.DataItem, OrderItemType.Product)) %>
                                </td>
                            </tr>
                            <tr>
                                <th align="right">
                                    <asp:Label ID="ShippingTotalLabel" runat="server" Text="Shipping:" />
                                </th>
                                <td align="right" width="80px">
                                    <%# string.Format("{0:lc}", GetTotal(Container.DataItem, OrderItemType.Shipping, OrderItemType.Handling)) %>
                                </td>
                            </tr>
                            <tr>
                                <th align="right">
                                    <asp:Label ID="TaxTotalLabel" runat="server" Text="Tax:" />
                                </th>
                                <td align="right" width="80px">
                                    <%# string.Format("{0:lc}", GetTotal(Container.DataItem, OrderItemType.Tax)) %>
                                </td>
                            </tr>
                            <tr id="trOther" runat="server" visible='<%# GetTotal(Container.DataItem, OrderItemType.Charge, OrderItemType.Coupon, OrderItemType.Credit, OrderItemType.Discount, OrderItemType.GiftCertificate, OrderItemType.GiftWrap) > 0 %>'>
                                <th align="right">
                                    <asp:Label ID="OtherTotalLabel" runat="server" Text="Other:" />
                                </th>
                                <td align="right" width="80px">
                                    <%# string.Format("{0:lc}", GetTotal(Container.DataItem, OrderItemType.Charge, OrderItemType.Coupon, OrderItemType.Credit, OrderItemType.Discount, OrderItemType.GiftCertificate, OrderItemType.GiftWrap)) %>
                                </td>
                            </tr>
                            <tr class="totalRow">
                                <th align="right">
                                    <asp:Label ID="TotalLabel" runat="server" Text="Total:" />
                                </th>
                                <td align="right" width="80px">
                                    <%# string.Format("{0:lc}", GetTotal(Container.DataItem)) %>
                                </td>
                            </tr>
                            <%--
                            <tr>
                                <th align="right">
                                    <asp:Label ID="PaymentsLabel" runat="server" Text="Payments:" />
                                </th>
                                <td align="right" width="80px">
                                    <%# string.Format("{0:lc}", GetTotalPayments(Container.DataItem)) %>
                                </td>
                            </tr>
                            <tr>
                                <th align="right">
                                    <asp:Label ID="BalanceLabel" runat="server" Text="Balance:" />
                                </th>
                                <td align="right" width="80px">
                                    <%# string.Format("{0:lc}", GetBalance(Container.DataItem)) %>
                                </td>
                            </tr>
                            --%>
                        </table>
                    </td>
                </tr>
            </table>
        </ItemTemplate>
    </asp:Repeater>
</asp:Content>
Rick Morris
Brewhaus (America) Inc.
Hot Sauce Depot

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: Features- are these part of AC7 already?

Post by mazhar » Thu Jan 01, 2009 11:17 am

We would like to add the Order Notes to the invoices, but need this information to be located on the correct invoices when printing the invoices in bulk from the Orders menu. The code in the referenced thread does print the notes on the order, but only if you print each order individually. If you print multiple orders via the Orders menu, all notes are placed on the last invoice in the set to be printed (if you print 10 invoices and there are notes on 3 of them, all three notes print on the last invoice).
This problem has been fixed in the original thread.

Post Reply