This topic is locked
[SOLVED]

  Simple registration of stock and sale of products

5/4/2012 10:11:47 PM
PHPRunner General questions
J
joiresende author

I have a sales table, with fields

id

product

mark

Date_of_Sale
And I have another table called inventory with the following fields:

id

product

mark

Date_of_purchase

Date_of_Sale

Status (sold) or (in stock)
I have an application that works very well where seeing the products in stock, select the table or stock the products you want to sell and realize the sale and so I record the sale in the sales table.
What I need is that when there is an addition to record sales in the sales table sale held also updates the Date_of_Sale

inventory in the table and change the Status field (in stock for sale).
Any ideas please. If you can also make a low inventory would be great.
Sorry for my english

J
joiresende author 5/10/2012

It can also be an example of application of low sales in stock

Sergey Kornilov admin 5/11/2012

It's a bit difficult to understand what exactly you trying to acheve. As far as I understand you trying to decrease the quantity in stock after order is placed.
You can use AfterAdd event of the table where you store sales/orders. The sample SQL query you need to execute is:

CustomQuery("Update Inventory set QuantityInStock = QuantityInStock - ". $values["Quantity"] . " where ProductID= " . $values["ProductID"]);



Hope this makes a bit of sense.

J
joiresende author 5/11/2012

Thank you for your response. Maybe too much and just tried to explain complicated. As my inventory control is done by serial it becomes unitary.

What I need is to put on the table inventory at the date of sale of each product.