Auto deduct value on add

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.
Post Reply
vintoICT
User
Posts: 414

Auto deduct value on add

Post by vintoICT »

Hello guys working on a simple sales record application. I have a table (salestbl) with columns salesid, salesdate,salesamount,salesqty,salestype.

Salestype could be either sold or returned now ,what i want to achieve is to deduct salesqty and amount if salestype = returned

if ($Salestype =returned) {

//deduct salesqty and salesamount
}

Thanks


scs
User
Posts: 694

Post by scs »

It depend on your amount & qty field. (is your amount & qty is signed field, then you can enter minus to the amount & qty)
Else if you can only entered unsighed value, then you just need to * -1 to the amount & qty.

if ($Salestype = returned) is not a valid syntax.
Single '=' is to assign value to a variable.
Unless 'returned' is pre-defined, otherwise will create problem too.


Post Reply