close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Stock balance query

Thread began 10/26/2012 3:01 pm by rogersds267040 | Last modified 10/29/2012 9:52 am by Jason Byrnes | 1534 views | 3 replies |

rogersds267040

Stock balance query

Since the actual database doesn't get updated and I'm not a sql expert, can I get assistance to get a list of products remaining balance by updating the sql below.Can't get the list to show stock with a 0 balance.

SELECT ProductStock,((SELECT ProductStock - coalesce(sum(DetailQuantity),0) AS NumLeft
FROM (orderdetails join orders on((orders.OrderID = orderdetails.DetailOrderID)))
WHERE ((orderdetails.DetailProductID = ProductID) and (orders.OrderDate > ProductUpdateDate)))) AS NumLeft,(SELECT CouponProductID FROM couponproducts WHERE couponproducts.ProductID = products.ProductID AND couponID = 41 LIMIT 1) AS CouponProductID,coalesce((select productoptions.GroupingID FROM productoptions where productoptions.ProductID = products.ProductID limit 1),products.ProductID) AS GroupingID FROM products WHERE ProductUnlimited = 0 AND ((SELECT ProductStock - coalesce(sum(DetailQuantity),0) AS NumLeft FROM (orderdetails join orders on((orders.OrderID = orderdetails.DetailOrderID))) WHERE ((orderdetails.DetailProductID = ProductID) and (orders.OrderDate > ProductUpdateDate))))

Sign in to reply to this post

Jason ByrnesWebAssist

I'm nit sure i understand what it is you are asking.

the stock in the products table should be getting updated when a purchase is made, are you saying that is not happening?

I have created a support ticket so we can look into this issue further.

To view and edit your support ticket, please log into your support history:
supporthistory.php

If anyone else is experiencing this same issue, please append to this thread.

Sign in to reply to this post

rogersds267040

Stock balance query

Sorry I wasn't clear.

The stock balance does get updated but not actually in the database.

My client is a service company who do repairs and sometimes uses the same stock. I have created additional pages in the admin to maintain their Technician work. One of the pages is to take parts from stock. I want to ensure that when they select a product/part from a dropdown list that there are sufficient item in stock.

I'm not a sql expert but was trying to modify your'll query to show the list of product but does show all the product.


If the quantity they select is in-sufficient, they get an error that says "The quantity you specified is not available in stock. The quantity field has been updated to reflect what is currently available."

Sign in to reply to this post

Jason ByrnesWebAssist

update the support ticket that was created and we can look into the query with you.

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...