• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps A Little help with my Ordering and Inventory Management App

renderTimingPixel.png

Hello guys,

I need help in my school project, I followed a tutorial in youtube in making a food ordering app, and then I converted that food ordering app to a water ordering app. My problem however is that the food ordering app I followed has no inventory management system. So I am adding an inventory management system because it is required in my school project. My problem now is how do I reduce the (product) stock after the user has placed his order the system calculates the total price, but I need to reduce the product stock.

This is how he calculates the total price from the cart.

https://pastebin.com/3QM9G5Ly

These are my model

https://pastebin.com/yA7c0FU1


I need to subtract the amount ( from the cart) in the product stock in order for me to complete the Ordering capability of the system. Thank you very much for your help!

I am thinking about using this
Code:
int stock = Integer.parseInt(Product.getQuantity(GET PRODUCT ID FROM USER CART) - Integer.parseInt(Order.getQuantity());

and then update the stock in product table in my firebase database. 

here is my firebase database

[IMG]https://i.stack.imgur.com/E14Qp.png[/IMG]
 

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones