vidhi
(Vidhi Raval1)
1
please can anyone give me the detail description on how to multiply the value of two fields and get its output automatically in the third field.
For example:
I have Quantity, Cost and Amount fields:
if i enter 2 -> Quantity
15000 -> Cost
then i should get the output 30,000 in amount.
please do reply me.
dniznick
(Dniznick)
2
Are you doing this in an html table or a gridview?
If in a gridview, you want to use the $data property.
For example, if you have columns A and B and want a calculated column C…
Instead of just listing columns like in the example, do this:
array(
'header'=>'Total Quantity',
'value'=>'$data->ColumnA * $data->ColumnB'
),
If just an html table its similar. Lets say you lookup a bunch of stuff with a findAll() call in your model.
In your view, do this:
foreach ($results as $result):
//echo table stuff
//for the <td> cell with the result you want:
<?php echo $result->columnA * $result->columnB; ?>
...
vidhi
(Vidhi Raval1)
3
Thanx sir. Sorry but i forgot to clear that i want the product of quantity and cost in the amount field while filling up the form.
That is, as soon as i type the value in quantity and cost i should automatically get the product of it in amount field.
I hope u got my question now.
Please do send me the proper code for it.
Please please do reply me, and help me out to solve this problem. Im new to yii.
Thanx.
rrhirani
(Rrhirani1990)
4
[color="#008000"] i used Jappendo extension.
i have following fields. itemname, quantity, price and amount.
i want to autofill textbox amout for calculating (quantity * price). [/color]