Query: Update order Status to Change QTY for Refunds/Cancellations

Created by Kevin Schmidt - HCPro, Modified on Thu, 9 Oct at 3:11 AM by Kevin Schmidt - HCPro

The following documentation is work around to orders that produce an error when there is an attempt to process a refund more than likely due to insufficient quantity from a split order (e.g. back-ordered, change in vendor needs). These errors are caused by a kit product where the quantity of the main product is non-zero, but the child products are zero.


reference tickets:


Overview: You will need to execute query to flip the original order to taken status, remove the batch, update the quantity, save the order, reapply the batch, and then flip the order back to shipped status.


NOTES:

  • Not recommended UI because it may trigger onset of various other complications. 
  • Recommended: Conduct updates in AptifyTest environment prior to making changes in AptifyProd.
  • Updates should have no impact on original order pricing or GLs.


**Before getting started, be sure to take a screenshot of the original order as reference to ensure all other information remains the same (excluding QTY).**


 --Order Statuses : Shipped = 2   /  Taken = 1--



Query 1: Look up the order 


Select * 

from aptify.dbo.OrderState

where ID = #


Query 2: Update order status 


update aptify.dbo.OrderState (or aptify.dbo.OrderStatusID)

set OrderStateID (or set OrderStatusID) = #                      

where ID = # 


Query 3: Look up batch number (to temporarily remove)


select * 

from aptify.dbo.OrderState

where ID =                                     


    --Copy batch number--


Query 4: Update batch to NULL (temporarily) and set order status to Taken (1)


update aptify.dbo.OrderState

set OrderStatusID = 1, BatchID = NULL

where ID = #

and batchID = # 


   --Back in Aptify, Update line item QTY in order record and click save--

--Take screenshots of the original order line items (including subproducts) and GLs-- 



Query 5: Reapply batch number and set order status to Shipped(2) 


update aptify.dbo.OrderState

set OrderStatusID = 2, BatchID = #

where ID = # 

and Batch = NULL


--Validate that there were no changes paid to payment lines, final order total, or GLs--

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article