Hi all, how are you?
I have an app where I can make sales and I can sales of products which are made of several basic products. All is fine when the parent product is added to the sale but the problem appears when I need to discount the basic products from the inventory..
I have three tables like follows
The table Productos which has a column for the original quantity in inventory of any product called Cantidad, one column fort the sold quantity called Cantidad vendida, one column for the spent quantity of basic ingredients based on the parent product and a column called Producto_compuesto which indicates if the product of that row is a parent product or a basic products (TRUE or FALSE).
I have a table called Orden_detalles which stores the quantity of any product added to a specific sale, that column doesn’t store the quantity of basic products added to the sale because I considered that the price of that basic product is in the price of the parent product.
I have a table called Receta, this table has the content of any compound product based on basic products and the quantity of basic product needed to make the parent product, the table has columns Producto_padre, Producto (the basic ingredients), Cantidad_requerida (the quantity needed of basic product to make the compound product) and a column called Suma_acumulada which is intended to store the quantity of a basic product used in any sale when a compound product is added.
I’ve been using Gemini to try to make it work but none of the suggestions or my ideas works in the intended way because of the following: I have several action all executed when the form for add a new element to the sale is saved like the following image
For some reason the sequence of the actions doesn’t update the column Suma_acumulada in Receta, then the column Cantidad vendida compuesta is filled with zeros instead of the sum of basic ingredients, so the basic products aren’t discounted from the inventory.
It is supposed that the third action in the grouped action calculates total punto of basic ingredientes spent in a compound product, then the last action in the grouped action copies those values to the column Cantidad vendida compuesta column of the Products table but when I first add a new compound product to the sale then this column is filled with zeros, I have to edit a compound product and then save it to allow those values to appear in the mentioned column.
What can I do to solve this?, thanks in advance for the help








