Announcement

Collapse
No announcement yet.

[code]: Using 'Cost Price' in your templates.

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

    [code]: Using 'Cost Price' in your templates.

    PHP Code:
    <actinic:block php="true" >
    $prodrefs "<actinic:variable name="ProductID" />";
        
    $connect odbc_pconnect("ActinicCatalog9","",""SQL_CUR_USE_ODBC);
            
    $query "SELECT [nCostPrice] FROM [Product] WHERE [Product Reference]='".$prodrefs."'";
            
    $result odbc_exec($connect$query);
            while(
    odbc_fetch_row($result)){ $ThisCostPrice odbc_result($result1); }
        
    odbc_close_all();  

    $ProductCostPriceFormatted "&pound;".number_format($ThisCostPrice/1002'.'',');
    $ProductCostPriceRaw number_format($ThisCostPrice/1002'.''');

    //uncomment as needed
    //echo $ProductCostPriceRaw;
    echo $ProductCostPriceFormatted;
    </
    actinic:block
    Until this gets fixed, this elegant hack will have to do.

    Drop this into your template at the product level.

    I made a template with it in and called it like this:
    HTML Code:
    <strong><actinic:variable name="CroweCostPrice" /></strong>
    This is, of course until Actinic fixes this, and lets us use it as a template variable.

    #2
    nice work, Mr C.
    I would not like to get in the way of your hacking axe!
    Tracey

    Comment


      #3
      Good work around Gabs.

      It's important to remember that when used in ernest in a report this variable may not perform as well as expected...

      It is saved online with the order details and downloaded with th order. That means that it can be reported using CR but...

      ...miscalculation can occur when the cost price is amended say for new stock. Sales of the old stock will then of course report the new cost value. So it only remains accurate if the stock split is accounted for in the calculation (very difficult to acheive) or of course you are not using stock control at all.

      Comment

      Working...
      X