This topic is locked
[SOLVED]

 Change Row Color based on Experation Day

3/1/2015 5:11:44 PM
PHPRunner General questions
S
shoppy author

I was looking at this topic: http://www.asprunner.com/forums/topic/18508-change-row-color-based-on-expiration-date/
The solution does not work for me.
Let me explain:

I have a library with dvd's.

One of the fields is named "Lend out", this field is a datefield.

I want to let the color of the field (the date) to change to red if the date is 60 days past the date that was entered.
Can someone help?

S
shoppy author 3/2/2015

I tried something else:

In the 'View as' Custom tab I placed:

if (date("Y-m-d",strtotime($value)+5184000)<=date("Y-m-d"))

$value = "<font color=red>".$value."</font>";


Now the datefield turns red if the date is past 60 days.

But it stays red even when the DVD is returned.

So now I like to turn it back to black when the DVD is returned.

When the other datefield ("returned") is filled with a returndate the "Lend out" field has to turn back to black.
Is this possible?

HJB 3/2/2015

For inspiration purposes only... (plus yours color code oriented strings to be added)
-ADD PAGE - before record added
$leanedout = $values["leanedout-date"] ; // Date 1

$returned = $values["return-date"] ; // Date 2
$leanedout-date = strtotime($leaned-out) ;

$return-date = strtotime($returned) ;
if ( ($return-date != null) and ( $leanedout-date >= $return-date ) )

{

$message = "Not yet returned!" ;

return false ;

}
return true;

F
fantasmino 3/2/2015

Don't know if this can help

I usually put a datediff in query tab:

http://xlinesoft.com/blog/2014/11/12/datetime-handling-in-web-applications/

then change color of row or cell if that value is > or < than 0

S
shoppy author 3/3/2015

Thanks very much, this helps.
Very nice to meet people who help others in these matters.

I learned al lot from you guy's.