This topic is locked

addition subtraction?

10/16/2009 11:26:39 AM
PHPRunner General questions
S
sadisticmagician author

Hello, it's possible addition and subtraction?
example:

id product stock

1 tv 12.555
in browser page edit it's possible insert -520 and the risultat =12.530 in automatic?
Thanks.

S
sadisticmagician author 10/18/2009



Hello, it's possible addition and subtraction?
example:

id product stock

1 tv 12.555
in browser page edit it's possible insert -520 and the risultat =12.530 in automatic?
Thanks.


no solution for this?

Thanks

Sergey Kornilov admin 10/18/2009

You need to rephrase your question of provide more details. It's hard to understand what exactly you asking.

S
sadisticmagician author 10/20/2009



You need to rephrase your question of provide more details. It's hard to understand what exactly you asking.


ok,
I have a store with stock of product
example tv in stock 25.595
i want subtraction 2.120 tv. it's possible a automatic count? ---> in edit table with 25.595, i want subtraction - 2.120 and is automatic total = 23.475 . Without use calculators. (sorry for my bad english)

P
Phil_G 10/20/2009

Will you always want to add or substract? Or sometimes replace the value alltogether? Are you using MySQL or some other system?



ok,
I have a store with stock of product
example tv in stock 25.595
i want subtraction 2.120 tv. it's possible a automatic count? ---> in edit table with 25.595, i want subtraction - 2.120 and is automatic total = 23.475 . Without use calculators. (sorry for my bad english)

J
Jane 10/20/2009

Hi,
use Before record added event on the Events tab to calculate this value.

Here is a sample:

$values["FieldName1"] = $values["FieldName1"] - $values["FieldName2"];
S
sadisticmagician author 10/22/2009



Will you always want to add or substract? Or sometimes replace the value alltogether? Are you using MySQL or some other system?


Yes, i need add or subtraction, example i want insert +12 in a box with 21.988 , and automatic calculate = 22.000 or -12 in a box with 21.988 and automatic calculate = 21.976. I used mysql sistem

mikue from germany 10/24/2009

add in myssql database table numeric field "correction"
if you wanna add amount in edit page just type in field correction e.g. 12

if you wanna substract amount in edit page just type in field correction e.g. -12
you will see the result after pressing the submit button
use Before record added event on the Events tab to calculate this value.

Here is a sample:

$values["stock"] = $values["stock"] + $values["correction"];

S
sadisticmagician author 10/25/2009



add in myssql database table numeric field "correction"
if you wanna add amount in edit page just type in field correction e.g. 12

if you wanna substract amount in edit page just type in field correction e.g. -12
you will see the result after pressing the submit button
use Before record added event on the Events tab to calculate this value.

Here is a sample:

$values["stock"] = $values["stock"] + $values["correction"];


hi , when I open "Before record added" in "Table Events" phprunner ask "select action" ---> email "send simple email" or ---> Database " save new data in other table" . Where I put your code?

J
Jane 10/26/2009

Hi,
do not add another actions.

Just add your custom code to this event.