This topic is locked

date field - custom view

8/9/2012 3:54:06 AM
PHPRunner General questions
J
jura author

hello,
in my invoice app. i have date field to display payment deadline.

i use next code, to display remaining time for payment deadline.




if ($value > NOW())

{

$firstTime=strtotime($value);

$lastTime=strtotime(NOW());

// perform subtraction to get the difference (in seconds) between times

$diff=$firstTime-$lastTime;

// convert

$years = floor($diff / (365606024));

$months = floor(($diff - $years
365606024) / (30606024));

$days = floor(($diff - $years 365606024 - $months30606024)/ (606024));

$hours = floor(($diff - $years 365606024 - $months30606024 - $days606024)/ (6060));

$minutes = floor(($diff - $years 365606024 - $months30606024 - $days606024 - $hours6060)/ 60);

$seconds = floor(($diff - $years
365606024 - $months30606024 - $days606024 - $hours6060 - $minutes*60));

//

$time_left = "";

if ($years > 0 ) { $time_left .= $years."Y ";}

if ($days > 0 ) { $time_left .= $days."D ";}

if ($hours > 0 ) { $time_left .= $hours."H ";}

if ($minutes > 0 ) { $time_left .= $minutes."M ";}

if ($seconds > 0 ) { $time_left .= $seconds."S";}

$value .= "<br/><STRONG><FONT COLOR='orange'>Expires in<br/>";

$value .= $time_left;

$value .= "</STRONG></FONT>";

}

else

{
// Show an Expired message below the date in red.

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

}

0
My question is, how to display message



[color=#1C2837]$value .= "<br/><font color='red'>**CLOSED**</font>";


in same table i have database field with dropdown list option 1. CLOSED and 2. OPEN...
When i select option CLOSED in this field, to display message "CLOSED" in another field (**date field which display payment deadline)





thanks**

J
jura author 8/11/2012



hello,
in my invoice app. i have date field to display payment deadline.

i use next code, to display remaining time for payment deadline.




if ($value > NOW())

{

$firstTime=strtotime($value);

$lastTime=strtotime(NOW());

// perform subtraction to get the difference (in seconds) between times

$diff=$firstTime-$lastTime;

// convert

$years = floor($diff / (365606024));

$months = floor(($diff - $years
365606024) / (30606024));

$days = floor(($diff - $years 365606024 - $months30606024)/ (606024));

$hours = floor(($diff - $years 365606024 - $months30606024 - $days606024)/ (6060));

$minutes = floor(($diff - $years 365606024 - $months30606024 - $days606024 - $hours6060)/ 60);

$seconds = floor(($diff - $years
365606024 - $months30606024 - $days606024 - $hours6060 - $minutes*60));

//

$time_left = "";

if ($years > 0 ) { $time_left .= $years."Y ";}

if ($days > 0 ) { $time_left .= $days."D ";}

if ($hours > 0 ) { $time_left .= $hours."H ";}

if ($minutes > 0 ) { $time_left .= $minutes."M ";}

if ($seconds > 0 ) { $time_left .= $seconds."S";}

$value .= "<br/><STRONG><FONT COLOR='orange'>Expires in<br/>";

$value .= $time_left;

$value .= "</STRONG></FONT>";

}

else

{
// Show an Expired message below the date in red.

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

}

0
My question is, how to display message



[color=#1C2837]$value .= "<br/><font color='red'>**CLOSED**</font>";


in same table i have database field with dropdown list option 1. CLOSED and 2. OPEN...
When i select option CLOSED in this field, to display message "CLOSED" in another field (**date field which display payment deadline)





thanks**


any help?

Sergey Kornilov admin 8/13/2012

I recommend to check this blog post for inspiration:

http://xlinesoft.com/blog/2011/01/03/tutorial_conditional_formatting/