Announcement

Collapse
No announcement yet.

php help

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    php help

    Thanks to norman a month or so ago I managed to get actinic to do some php calculation for me when the site is generated.

    <actinic:block php="true">
    $units = '<actinic:variable name="CUST_UNITS_PER_OUTER" encoding="perl" selectable="false" />'; // load as string in case variable empty
    if ( $units != '' )
    {
    $cost = '<actinic:variable name="ProductPriceRaw" encoding="perl" selectable="false" />'; // load as string in case variable empty
    $cost = preg_replace('/£|,/', '', $cost); // remove any £ and ,
    $unitcost = $cost / $units; // do the arithmetic
    printf(' £%.2f', $unitcost);
    }
    </actinic:block>
    The above php solution gives me a cost per unit ex vat

    I now need to take this one step further.
    1. work out the unit cost + vat if applicable = UNIT COST INC
    2. Minus the UNIT COST INC from my variable <actinic:variable name="CUST_SELL_AT" /> = PROFIT
    3. then divide the PROFIT by the variable <actinic:variable name="CUST_SELL_AT" /> to give me the PROFIT ON RETURN


    I know that this is a complex one but any help would be appreciated.
    David Mawson
    Phoenix Trading

    http://www.sweetswholesale.co.uk - Wholesale confectionery suppliers

    #2
    I've no free time this month so I hope someone else is willing to go to all the effort that requires.

    You might consider doing it yourself - it's a matter of extending what's above but a lot of work to test as it's particular to your site.

    I recommend the book PHP ın 24 Hours - that's what I use.
    Norman - www.drillpine.biz
    Edinburgh, U K / Bitez, Turkey

    Comment


      #3
      I appreciate what you are saying norman

      I will give it a bash tonight

      Thanks for your help anyway
      David Mawson
      Phoenix Trading

      http://www.sweetswholesale.co.uk - Wholesale confectionery suppliers

      Comment

      Working...
      X