This topic is locked

display negative value in html mode

4/28/2008 3:04:22 AM
PHPRunner General questions
A
amuro author

Hi, support
i create a report, situation is....

the amount field of table is recorded always with positive value, no matter selling or returning goods.

if selling, recway field is 'S', the other is 'C'.

how to show negative value if returning goods. and the total amount are selling amount deduce returning amount.
thank you. <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=question&id=8328&image=1&table=forumtopics' class='bbc_emoticon' alt=':D' />

J
Jane 4/28/2008

Hi,
here are some tips:

  1. to display negative value use custom format on the "View as" settings dialog on the Visual Editor tab.

    Here is a sample:
    global $data;

    if ($data["recway"]=="C")

    $value = $value * (-1);


2. to re-calculate total value use events on the Events tab.

List page: Before process event:

$_SESSION["total"] = 0;


List page: After record processed event:

$_SESSION["total"]+= $row["1FieldName_value"];


List page: Before display event:

$smarty->assign("showtotal_FieldName",$_SESSION["total"]);

$_SESSION["total"] = 0;

A
amuro author 4/29/2008

thanks, Jane
I can't find the after record processed event in report.

J
Jane 4/29/2008

Sorry for my fault.

These events are only for simple tables, not for reports.
Unfortunately there is no easy way to do the same for the reports.

As workaround you can change values in the database (replace positive with negative values if needed).

A
amuro author 5/16/2008

thank you, Jane
there are 3 columns show minus value if in this condition,

how could I code at phprunner?

A
amuro author 5/16/2008

thank you, Jane

there are 3 columns show minus value if in this condition,

how could I code at phprunner?


solved, just set 2 another session to store them