Making note of orders already printed

For general questions and discussions specific to the AbleCommerce 7.0 Asp.Net product.
Brewhaus
Vice Admiral (VADM)
Vice Admiral (VADM)
Posts: 878
Joined: Sat Jan 19, 2008 4:30 pm

Making note of orders already printed

Post by Brewhaus » Fri Oct 24, 2008 8:46 am

I know that we touched on this in a separate topic previously, but I wonder if there is a way to add a marker of some sort to the order list that will note when an order has already been printed. Because for varying reasons an order may have been printed but not completed on a given day, we need to be sure that we do not miss printing an order by thinking it has been printed previously.

Although having this automated would be great (ie. a field gets an 'x' once the order is printed), having to do this manually would not be a tremendous task. What we would need to do is add a new field in the Order list where we manually mark the orders that we print, and have this information saved so that it will show us that the order has already been printed.

Does anyone have advice on this?
Rick Morris
Brewhaus (America) Inc.
Hot Sauce Depot

Robbie@FireFold
Commodore (COMO)
Commodore (COMO)
Posts: 433
Joined: Wed May 28, 2008 9:42 am
Location: Concord, NC
Contact:

Re: Making note of orders already printed

Post by Robbie@FireFold » Fri Oct 24, 2008 9:25 am

We created a status called 'Sent to Warehouse' which we change each order we print to this.

Something cool would be:

When we print a packing slip it automatically triggers sent to warehouse.

That would save a nice step for us.
Robbie Hodge
General Manager
Robbie@FireFold.com
http://www.FireFold.com

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

Re: Making note of orders already printed

Post by mazhar » Fri Oct 24, 2008 10:28 am

We created a status called 'Sent to Warehouse' which we change each order we print to this.

Something cool would be:

When we print a packing slip it automatically triggers sent to warehouse.

That would save a nice step for us.
You have to manually send the Email as discussed in this thread
viewtopic.php?f=42&t=8682

Robbie@FireFold
Commodore (COMO)
Commodore (COMO)
Posts: 433
Joined: Wed May 28, 2008 9:42 am
Location: Concord, NC
Contact:

Re: Making note of orders already printed

Post by Robbie@FireFold » Fri Oct 24, 2008 11:20 am

mazhar wrote:
We created a status called 'Sent to Warehouse' which we change each order we print to this.

Something cool would be:

When we print a packing slip it automatically triggers sent to warehouse.

That would save a nice step for us.
You have to manually send the Email as discussed in this thread
viewtopic.php?f=42&t=8682
I think the OP was talking about a feature for internal use.

Our status's

In Process(if any order is paid it comes here)
Sent to Warehouse(if printed by the person appointed to orders)
Completed(Shipped)

It's just a way for us to keep up what was printed to avoid duplicate packing slips in the warehouse. It also serves as a way to check where things are going wrong.

If we could make an order change from In Prcoess to Sent to Warehouse by an 'action(aka printing a packing slip') it would save some time/help automate that process.

We deal with 300+ orders per day so you can imagine it gets a little complicated.
Robbie Hodge
General Manager
Robbie@FireFold.com
http://www.FireFold.com

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

Re: Making note of orders already printed

Post by Brewhaus » Mon Dec 01, 2008 9:57 pm

Is there a (simple) way to add an additional column to the Orders menu so that we could either manually or (preferably) automatically have a check mark or other indicator in this new column to show us that an order has been printed? It is a tremendous hassle having to ask in the warehouse if an order has been printed, or what their last order number is. The software for our other site automatically marks an order as printed when it is sent to print, and it greatly simplifies life in that respect.
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: Making note of orders already printed

Post by mazhar » Tue Dec 02, 2008 5:08 am

Is there a (simple) way to add an additional column to the Orders menu so that we could either manually or (preferably) automatically have a check mark or other indicator in this new column to show us that an order has been printed? It is a tremendous hassle having to ask in the warehouse if an order has been printed, or what their last order number is. The software for our other site automatically marks an order as printed when it is sent to print, and it greatly simplifies life in that respect.
A quick solution is to use a new order status for the order. For example create a new OrderStatus named "Printed" and don't attach it with any trigger. Now find out the OrderStausId by looking into the ac_OrderStatuses table, for example it was 7 for me. Now you need to put some code some where where you want to mark the orders as printed for example I placed a button at Invoice page which i used to change the status of the order to printed. Once you changed the status of the order the Order Manger status will show you the status as Printed for printed orders. I am attaching the modified Invoice page

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

Re: Making note of orders already printed

Post by Brewhaus » Tue Dec 02, 2008 8:22 am

I have not opened the Invoice.aspx file that you attached, so I have a quick question on it. Will the printing of an order automatically trigger the change of status to Printed, or do we need to manually check a box on each invoice when we go to print them?
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: Making note of orders already printed

Post by mazhar » Tue Dec 02, 2008 8:43 am

After printing the order you have to manually click an extra button which will mark it the printed order.

User avatar
heinscott
Captain (CAPT)
Captain (CAPT)
Posts: 375
Joined: Thu May 01, 2008 12:37 pm

Re: Making note of orders already printed

Post by heinscott » Tue Dec 02, 2008 8:47 am

Attach a server method to your print button in either Admin/Orders/Print/PackSlips.aspx, or Invoice, or PullSheet, etc, depending on what you use. We use the packslips, so here is an example from there.
First, the code for the method to run server side on the print button.

Code: Select all

<asp:Button ID="Print" runat="server" Text="Print" OnClientClick="window.print();" OnClick="SetPrintStatus" />
then, the StePrintStatus method...

Code: Select all

protected void SetPrintStatus(object sender, EventArgs e)
    {
        List<int> selectedOrders = GetSelectedOrders();
        foreach (int orderId in selectedOrders)
        {
            Order thisOrder = OrderDataSource.Load(orderId);
            thisOrder.OrderStatusId = 9; //or, whatever the id of your "printed" status
            thisOrder.Save();
        }
    }
Pretty straight forward, I think.
Hope this helps.

Scott

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

Re: Making note of orders already printed

Post by Brewhaus » Thu Dec 04, 2008 8:32 am

We used Mazhar's file, and everything was great except that I forgot we had customized the Invoice printout. Having not gone through the file, is there a specific section from the file that we can pasted into our customized file to put the button in place as in Mazhar's file?

Alternatively, your method, Scott, appears to be simple (as it appears to be automatic when we print). I assume that we simply overwrite the existing (similar) code?
Rick Morris
Brewhaus (America) Inc.
Hot Sauce Depot

User avatar
heinscott
Captain (CAPT)
Captain (CAPT)
Posts: 375
Joined: Thu May 01, 2008 12:37 pm

Re: Making note of orders already printed

Post by heinscott » Thu Dec 04, 2008 8:39 am

Mine was just an add-on. New method, new button.
Hope that helps.

Scott

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

Re: Making note of orders already printed

Post by mazhar » Thu Dec 04, 2008 8:43 am

Yes you can use the technique soctt told. Edit your Invoice file and add following method to it

Code: Select all

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);
    }
Now find the following line of code

Code: Select all

<asp:Button ID="Print" runat="server" Text="Print" OnClientClick="window.print();return false;" />
and make it look like

Code: Select all

<asp:Button ID="Print" runat="server" Text="Print" OnClientClick="window.print();return true;" OnClick="MarkPrinted_Click" />
This change will change the order status with the print button.

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

Re: Making note of orders already printed

Post by Brewhaus » Sun Dec 07, 2008 9:28 am

Thank you. I did not want to make any assumptions, but it was pretty straight-forward. :D
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: Making note of orders already printed

Post by Brewhaus » Wed Dec 17, 2008 11:03 am

I noted yesterday and today that if a customer has us add to their order via the Edit Order Items menu (after the order has been placed) that if the order is marked as 'Order Printed' then the inventory is not adjusted accordingly. If we change the status to 'Shipment Pending' then the inventory is updated.

Should we set the 'Order Printed' status to Destock (currently it is blank)? We had left the status blank (neither Destock nor Restock) because I was concerned that duplicating the process would Destock the product a second time. Can anyone shed some light on this?
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: Making note of orders already printed

Post by Brewhaus » Sat Oct 01, 2011 2:17 pm

Now that we have upgraded to 7.0.7 this method of automatically changing the order status no longer works, as the ASPX file has been split into two files (ASPX and ASPX.CS). We have tried using the code mentioned above a few different ways, but it either does nothing or throws an error, depending on how we do this. How do we change our invoices.aspx and invoices.aspx.cs to automatically update the order status?
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: Making note of orders already printed

Post by mazhar » Mon Oct 24, 2011 11:04 am

I am not sure why it didn't worked for you. Beside we broke the page into two files there is no other change that could break this mod. I am attaching latest files for Invoices.aspx and Invoices.aspx.cs those includes this custom code. Give them a try but before that don't forget to take backup of your existing Invoices.aspx and Invoices.aspx.cs files.

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

Re: Making note of orders already printed

Post by Brewhaus » Wed Oct 26, 2011 10:09 pm

I tried using the files but get sent to the general error page where I receive the following error:

We are sorry, but the page you are trying to access has experienced an error.
Please contact us to report this problem.
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: Making note of orders already printed

Post by Brewhaus » Thu Oct 27, 2011 3:12 pm

I have compared the files versus the standard versions, and the changes seem straight forward (and match what we had tried before), but we get the error noted above. Has anyone else used the files that Mazhar attached above without any issues, or are others getting this error, as well?
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: Making note of orders already printed

Post by mazhar » Fri Oct 28, 2011 7:25 am

Go check the error log at Administration > Help > Error Log. The error you are seeing could be due to some other change if you have modified your document for some other customization.

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

Re: Making note of orders already printed

Post by Brewhaus » Fri Oct 28, 2011 8:51 am

The error (Debug Data) is:

Exception of type 'System.Web.HttpUnhandledException' was thrown.; This method can only be called when the object data has not been modified (IsDirty == false)
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: Making note of orders already printed

Post by mazhar » Fri Oct 28, 2011 9:35 am

Well it seems like your order object is dirty(contains unsaved changes) prior to order status update. Try saving it before you change the order status something like.

Code: Select all

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.Save();
            order.UpdateOrderStatus(orderStatus);
}
    }

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

Re: Making note of orders already printed

Post by Brewhaus » Fri Oct 28, 2011 11:29 am

That seemed to work. Do you know what would cause this, and is it a big deal?
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: Making note of orders already printed

Post by mazhar » Mon Oct 31, 2011 6:05 am

Actually

Code: Select all

order.UpdateOrderStatus(orderStatus)
methods expects that order must not be in dirty state. If UpdateOrderStatus call sees the order has some stuff that is not saved then it throws the exception you were seeing before. I am not sure what was being updated upon order before this UpdateOrderStatus call, seems like you are updating something upon order before updating its status. Just make sure that if you are updating the order intentionally then make sure to save changes prior to calling UpdateOrderStatus.

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

Re: Making note of orders already printed

Post by Brewhaus » Mon Oct 31, 2011 7:42 am

Thank you for the explanation, Mazhar. This is just our development site, so I will test without the added code when we move to the updated live site, as the previous code has been working without any issues.

Code: Select all

{
order.Save();
            order.UpdateOrderStatus(orderStatus);
}
This is the only code that was added to the .cs file because of our problem, correct?
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: Making note of orders already printed

Post by Brewhaus » Thu Jul 11, 2013 2:43 pm

I am astonished that AC has still not built this into the software as a default, as I would expect that virtually everyone needs to know what has been printed and what has not, if for no other reason than to ensure that an order was not missed when they were printed. In any event, this is still a customization in Gold, and when we try to use the above code (placed the same as in our 7.0.7 files) we get a compliation error. To be honest, we would prefer to use our 7.0.7 files, as they already have the layout work done. Is there a straightforward way to 'update' our 7.0.7 invoice files to work in Gold? If not, can anyone help with an updated version of the above code to mark the orders shipped when we print them?
Rick Morris
Brewhaus (America) Inc.
Hot Sauce Depot

Post Reply