This topic is locked

subtract

11/17/2009 6:03:40 AM
PHPRunner General questions
M
munkeh author

Hi,
Searched the forums but unable to find a look-alike...
We have a few fields with
Stock :

Sold :
When we sell an item, we want the number we fill in the field 'sold' subtracted from the field 'stock'.

The field stock should be changed to the stock minus the sold number when the next employee sells one.

This seems simple but I cant figure out how to do this. (very new to this kind of stuff)
thanks in advance,

regards

J
Jane 11/17/2009

Hi,
use Before record added event on theEvents tab.

Here is a sample:

$values["Stock"] = $values["Stock"]-$values["Sold";]
M
munkeh author 11/17/2009

Hi Jane,
Thank you for the quick support.

I forget to mention 1 important thing though.

Stock is in table1

Sold is in table2

Is it possible to do it this way then?



Hi,
use Before record added event on theEvents tab.

Here is a sample:

$values["Stock"] = $values["Stock"]-$values["Sold";]


J
Jane 11/18/2009

Hi,
how are these two tables connected?

M
munkeh author 11/18/2009

Hi,
They are not connected. (sorry for being pretty new in this kind of material)

Do I need to make a master-child connection between them for this to work?



Hi,
how are these two tables connected?

M
munkeh author 11/19/2009

Hope to clarify a bit with this :
Initial stock is in table1 (filled in by employee)

Amount Sold is in table2 (filled in by employee)

Left over Stock is in table2 (this has to be calculated by the system)
It has to calculate like this :

Employee1 fills in the initial stock (1 time)

Employee2 fills in amount sold every time there is an item sold.

This has to be subtracted from 'Left over Stock' every time an item is sold.
regards,

J
Jane 11/19/2009

It's impossible to update values if these tables are not connected.

Do you have ProductID for example in all these tables?

M
munkeh author 11/20/2009

Hi,
Is there a manual somewhere describing this kind of setup?

Think I got lost in your last message <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=45586&image=1&table=forumreplies' class='bbc_emoticon' alt=':)' />
thanks,

J
Jane 11/24/2009

I recommend you to publish your project on Demo Account and open a ticket at http://support.xlinesoft.com sending a URL to your pages along with detailed description of what you want to achieve.

M
munkeh author 12/23/2009

Hi Jane,
I uploaded it to the demo account.

Regards,