This topic is locked

Adding

6/15/2007 7:12:32 PM
PHPRunner General questions
B
bobby123 authorDevClub member

Hi
I am hoping someone can help me with 2 questions.

  1. I have 3 column's cost / margin / total, what I want to achieve is
    Cost Margin Total

    100 + or x 10.0% = 100
    I would like to make the Margin a dropdown selection of 10%, 15%, 20% and so on

    <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=question&id=5522&image=1&table=forumtopics' class='bbc_emoticon' alt=':rolleyes:' />

    What code do I need to add to achieve this this.
  2. And where to I put the code.
    Thanks for any help with this
    Bobby

J
Jane 6/18/2007

Bobby,
to create dropdown with percent value just select Lookup wizard --> List of values on the "Edit as" settings dialog on the Visual Editor tab and add your values to this dropdown. Then select Custom on the "View as" settings dialog and add following code in it:

$value = $value."%";

To calculate Total value use Before record added and Before record updated events on the Events tab.

Here is a sample code:

$values["Total"] = $values["Cost"]+$values["Cost"]*$values["Margin"]/100;