Posted 10 March 2012 - 05:45 AM
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.
Posted 10 March 2012 - 09:55 AM
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; ?> ...
Posted 12 March 2012 - 01:25 AM
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.