i have the following:
Expand|Select|Wrap|Line Numbers
- <html>
- <STYLE type="text/css">
- TD{font-family:ARIAL;font-size:11px;color:#666666;}
- BODY{font-family:ARIAL;font-size:11px;color:#666666;background-color:#eeeeee;margin-top:40px;margin-bottom:0px;margin-left:40px;margin-right:0px;}
- FORM{display:inline;}
- A:LINK, A:VISITED{color:#6699cc;text-decoration:none;}
- A:HOVER{text-decoration:underline;color:#CCCCCC;}
- .HOMETEXT{font-size:14px;}
- .ITEMNAME{font-size:14px;font-weight:BOLD;}
- /*.WHITELINK{color:#ffffff;font-size:10px;}*/
- .INPUT{border-color:#66CCFF;border-width:1px;border-style:solid;background-color:#eeeeee;font-size:10px;}
- .INPUT2{background-image:url(webtd_grass_matrix_pic4.jpg);color:#666666;border-top:1px solid #BBBBBB;border-bottom:1px solid #BBBBBB;border-right:1px solid #BBBBBB; border-left:1px solid #BBBBBB; font-family:copperplate gothic light;font-size:7pt;}
- .BUTTON{border-color:#99CCFF;border-width:1px;border-style:solid;}
- .BOLD{color:#666666;font-family:Arial, Tahoma, Helvetica, sans-serif;font-size:8pt;font-weight:BOLD;}
- .BOLDLARGE{color:#666666;font-size:12pt;font-weight:BOLD;}
- .CURRENTPAGE{color:#666666;font-size:8pt;font-weight:BOLD;}
- .ERROR{color:#cc0033;font-size:8pt;font-weight:BOLD;}
- .MENUCELL{height:24px;width:80px;text-align:center;font-weight:BOLD;color:#FFFFFF;border-top:1px solid #BBBBBB;border-bottom:1px solid #BBBBBB;border-right:1px solid #BBBBBB;}
- .MENUCELLSTART{height:24px;width:80px;border:1px solid #BBBBBB;text-align:center;font-weight:BOLD;color:#FFFFFF;}
- .SPACE1{padding-left:20px;}
- .BORDER{background-color:#EEEEEE;color:#666666;border-top:1px solid #BBBBBB;border-bottom:1px solid #BBBBBB;border-right:1px solid #BBBBBB;height:24px;padding-left:16px;}
- .BORDERNEW{background-color:#EEEEEE;color:#666666;border-top:1px solid #BBBBBB;border-bottom:1px solid #BBBBBB;border-left:1px solid #BBBBBB;border-right:1px solid #BBBBBB;height:170px;padding-left:0px;}
- .BGWHITE{background-color:#FFFFFF;color:#666666;border-top:1px solid #BBBBBB;border-bottom:1px solid #BBBBBB;border-left:1px solid #BBBBBB;border-right:1px solid #BBBBBB;height:170px;padding-left:20px;}
- .BORDER1{border-bottom:1px solid #BBBBBB;}
- .BORDER2{background-color:#EEEEEE;color:#666666;border:1px solid #BBBBBB;}
- .BORDER3{background-color:#000000;c olor:#666666;border-top:1px solid #ffffff;border-bottom:1px solid #ffffff;border-right:1px solid #ffffff;height:44px;padding-left:16px;}
- .HEADER{background-color:#EEEEEE;color:#666666;border:1px solid #BBBBBB;height:24px;font-weight:BOLD;padding-left:20px;}
- .PRODCELL{border-left:1px solid #BBBBBB;border-bottom:1px solid #BBBBBB;background-color:#FFFFFF;}
- .HEADER1{background-color:#EEEEEE;color:#666666;border-left:1px solid #BBBBBB;border-top:1px solid #BBBBBB;border-bottom:1px solid #BBBBBB;height:24px;font-weight:BOLD;padding-left:20px;}
- .HEADER5{width:130px;color:#666666;background-color:#EEEEEE;border-top:1px solid #BBBBBB;border-right:1px solid #BBBBBB;height:24px;}
- .PRODIMGLGCELL{width:300px;height:295px;background-color:#EEEEEE;border-left:1px solid #BBBBBB;border-right:1px solid #BBBBBB;border-bottom:1px solid #BBBBBB;vertical-align:top;text-align:center;}
- .PRODIMGSMCELL{width:130px;height:125px;background-color:#EEEEEE;border-left:1px solid #BBBBBB;border-right:1px solid #BBBBBB;border-bottom:1px solid #BBBBBB;vertical-align:top;text-align:center;}
- .PRODIMGSM{border:1px solid white;height:120px;width:120px;align:middle;}
- .PRODIMGLG{border:1px solid #BBBBBB;height:290px;width:290px;align:middle;}
- .CATIMG{width:120px;height:120px;border:1px solid #BBBBBB;}
- .stylegreyblue {color: #669999}
- .stylelightblue {color: ##DEE7F7}
- .styleblack {color:#000000}
- .stylegreyblack {color:#444444}
- .styledarkpink {color: #990033}
- .styleslateblue {color: #008b8b}
- .stylewhite {color: #ffffff}
- .input.btn {color:#666666; font: bold small 'trebuchet ms',helvetica,sans-serif;
- background-color: #eeeeee;
- border:1px solid;
- border-color: #66CCFF #66CCFF #66CCFF #66CCFF;
- font-size:11px;
- }
- .style17 {color: #666666}
- .stylelightsteelblue {color: #BOC4DE}
- .stylenewgrey {color: #D1D1D1}
- .style18 {color: #CC6699}
- .style19 {color: #CCCCCC}
- .style22 {font-family: Verdana; color: #CCCCCC;}
- .style23 {color: #66CCFF}
- .style24 {
- color: #99FF66;
- font-weight: bold;
- }
- .style26 {color: #99FF66}
- .style27 {color: #999999}
- .stylered {color: #FF0000}
- .stylegreen {color: #00FF00}
- .CONIFERCOLOR {color: #660000}
- </STYLE>
- </head>
- <BODY>
- <?php
- // script dies after 120 secs
- set_time_limit(120);
- ?>
- <br>
- <br>
- <?php
- //The function returns the no. of business days between two dates and it skips the holidays
- function getWorkingDays($startDate,$endDate,$holidays){
- //The total number of days between the two dates. We compute the no. of seconds and divide it to 60*60*24
- //We add one to inlude both dates in the interval.
- $days = (strtotime($endDate) - strtotime($startDate)) / 86400; //used for calculating elapsed bus. days
- //$days2 = (strtotime($endDate) - strtotime($startDate)) / 86400 + 1; //used for calculating business days
- $no_full_weeks = floor($days / 7);
- $no_remaining_days = fmod($days, 7);
- //It will return 1 if it's Monday,.. ,7 for Sunday
- $the_first_day_of_week = date("N",strtotime($startDate));
- $the_last_day_of_week = date("N",strtotime($endDate));
- //---->The two can be equal in leap years when february has 29 days, the equal sign is added here
- //In the first case the whole interval is within a week, in the second case the interval falls in two weeks.
- if ($the_first_day_of_week <= $the_last_day_of_week){
- if ($the_first_day_of_week <= 6 && 6 <= $the_last_day_of_week) $no_remaining_days--;
- if ($the_first_day_of_week <= 7 && 7 <= $the_last_day_of_week) $no_remaining_days--;
- }
- else{
- if ($the_first_day_of_week <= 6) {
- //In the case when the interval falls in two weeks, there will be a Sunday for sure
- $no_remaining_days--;
- }
- }
- //The no. of business days is: (number of weeks between the two dates) * (5 working days) + the remainder
- //---->february in none leap years gave a remainder of 0 but still calculated weekends between first and last day, this is one way to fix it
- $workingDays = $no_full_weeks * 5;
- if ($no_remaining_days > 0 )
- {
- $workingDays += $no_remaining_days;
- }
- //We subtract the holidays
- foreach($holidays as $holiday){
- $time_stamp=strtotime($holiday);
- //If the holiday doesn't fall in weekend
- if (strtotime($startDate) <= $time_stamp && $time_stamp <= strtotime($endDate) && date("N",$time_stamp) != 6 && date("N",$time_stamp) != 7)
- $workingDays--;
- }
- return $workingDays;
- }
- ?>
- <?php
- $i = 1;
- //get timestamp for past/future date I want
- $pf_time = strtotime("-".$i." day");
- //format the date using the timestamp generated
- $previous_day = date("d M Y", $pf_time);
- ?>
- <?php
- $holidays=array("25 Dec 2008","26 Dec 2008","16 Feb 2009");
- $days_in_month = date("t");
- $elapsed_business_days = getWorkingDays(date("1 M Y"),$previous_day,$holidays); //gets the number of working days elapsed in the current month minus any holidays
- echo "elapsed business days:";
- echo $elapsed_business_days;
- ?>
- <?php
- #**********************************************************************************
- //The function returns the no. of business days between two dates and it skips the holidays
- function getWorkingDaysTOT($startDate2,$endDate2,$HOLS){
- //The total number of days between the two dates. We compute the no. of seconds and divide it to 60*60*24
- //We add one to inlude both dates in the interval.
- $days2 = (strtotime($endDate2) - strtotime($startDate2)) / 86400+1; //used for calculating elapsed bus. days
- $no_full_weeks2 = floor($days2 / 7);
- $no_remaining_days2 = fmod($days2, 7);
- //It will return 1 if it's Monday,.. ,7 for Sunday
- $the_first_day_of_week2 = date("N",strtotime($startDate2));
- $the_last_day_of_week2 = date("N",strtotime($endDate2));
- //---->The two can be equal in leap years when february has 29 days, the equal sign is added here
- //In the first case the whole interval is within a week, in the second case the interval falls in two weeks.
- if ($the_first_day_of_week2 <= $the_last_day_of_week2){
- if ($the_first_day_of_week2 <= 6 && 6 <= $the_last_day_of_week2) $no_remaining_days2--;
- if ($the_first_day_of_week2 <= 7 && 7 <= $the_last_day_of_week2) $no_remaining_days2--;
- }
- else{
- if ($the_first_day_of_week2 <= 6) {
- //In the case when the interval falls in two weeks, there will be a Sunday for sure
- $no_remaining_days2--;
- }
- }
- //The no. of business days is: (number of weeks between the two dates) * (5 working days) + the remainder
- //---->february in none leap years gave a remainder of 0 but still calculated weekends between first and last day, this is one way to fix it
- $workingDays2 = $no_full_weeks2 * 5;
- if ($no_remaining_days2 > 0 )
- {
- $workingDays2 += $no_remaining_days2;
- }
- //We subtract the holidays
- foreach($HOLS as $HOL){
- $time_stamp2=strtotime($HOL);
- //If the holiday doesn't fall in weekend
- if (strtotime($startDate2) <= $time_stamp2 && $time_stamp2 <= strtotime($endDate2) && date("N",$time_stamp2) != 6 && date("N",$time_stamp2) != 7)
- $workingDays2--;
- }
- return $workingDays2;
- }
- ?>
- <?php
- $c = 1;
- //get timestamp for past/future date I want
- $pf_time2 = strtotime("-".$c." day");
- //format the date using the timestamp generated
- $previous_day2 = date("d M Y", $pf_time2);
- ?>
- <?php
- $HOLS=array("25 Dec 2008","26 Dec 2008","16 Feb 2009");
- #echo getWorkingDaysTOT("2009-02-15","2009-02-21",$HOLS);
- ?>
- <?php
- $days_in_month2 = date("t");
- $elapsed_business_days2 = getWorkingDaysTOT(date("1 M Y"),$previous_day2,$HOLS); //gets the number of working days elapsed in the current month minus any holidays
- $business_days2 = getWorkingDaysTOT(date("1 M Y"),date("$days_in_month2 M Y"),$HOLS);
- ?>
- <?php
- /*
- function destroy_foo()
- {
- global $foo;
- unset($foo);
- }
- $foo = $business_days2;
- destroy_foo();
- echo "<br>";
- echo "this is FOO:";
- echo $foo;
- */
- ?>
- <?php
- echo "<br>";
- echo "business days:";
- echo $business_days2;
- #**********************************************************************************
- ?>
- <?php
- echo "<br><br>";
- print "<span style='color: #660000; font-size: 8pt; font-family: arial'>";
- echo "<b>";
- echo"Conifer Operational Cash<br>";
- echo "</b>";
- print "</span>";
- #################################################
- #DETAIL SECTION
- #################################################
- $conn=odbc_connect('DAILYCASH','','');
- if (!$conn)
- {exit("Connection Failed: " . $conn);}
- $sqlREGION="SELECT DISTINCT Region FROM qry_ttlPAYMENTS";
- $rsREGION=odbc_exec($conn,$sqlREGION);
- while (odbc_fetch_row($rsREGION))
- {
- $REG=odbc_result($rsREGION, Region);
- #echo "<tr>";
- #echo "<tr>";
- echo "<br>";
- echo $REG;
- #echo "</tr>";
- #echo "<br>";
- #$sql="SELECT TRCFAC, TTLPAYMENTS as TTL FROM qry_ttlPAYMENTS WHERE TRCFAC = 'JON'";
- $sql="SELECT TRCFAC, TTLPAYMENTS as TTL FROM qry_ttlPAYMENTS WHERE Region ='".$REG."'";
- $rs=odbc_exec($conn,$sql);
- #print "<br>";
- if (!$rs)
- {exit("Error in SQL");}
- while (odbc_fetch_row($rs))
- {
- $FAC=odbc_result($rs, TRCFAC);
- $MTDCASH=odbc_result($rs, TTL);
- $sql2="SELECT fac, hospname, ttl FROM qry_goals WHERE fac ='".$FAC."'";
- $rs2=odbc_exec($conn,$sql2);
- $MONTHLYGOAL=odbc_result($rs2, ttl);
- $HOSPNAME=odbc_result($rs2, hospname);
- $MTDGOAL = +$MONTHLYGOAL/$business_days2 * $elapsed_business_days;
- $MTDVARIANCE = $MTDCASH - $MTDGOAL;
- if($MTDGOAL == '0')
- {
- $MTDpercenttoGOAL =0;
- #echo "MTD goal is ZERO";
- }
- elseif($MTDCASH == '0')
- {
- #echo "MTD CASH IS ZERO";
- $MTDpercenttoGOAL =0;
- }
- else
- {
- #echo "ALL GOOD";
- $MTDpercenttoGOAL = +$MTDCASH/$MTDGOAL * 100;
- $MTDpercenttoGOALformatted = sprintf("%%",$MTDpercenttoGOAL);
- }
- echo "<br>";
- #echo "<td bgcolor = '#ffffff'>";
- echo $REG;
- echo $FAC;
- #echo "</td>";
- #echo "<td bgcolor = '#ffffff'>";
- echo $HOSPNAME;
- #echo "</td>";
- #echo "<td bgcolor = '#ffffff'>";
- #echo "  ";
- echo number_format($MONTHLYGOAL);
- #echo "</td>";
- #echo "<td bgcolor = '#ffffff'>";
- #echo "  ";
- echo number_format($MTDCASH);
- #echo "</td>";
- #echo "<td bgcolor = '#ffffff'>";
- #echo "  ";
- echo number_format($MTDGOAL);
- #echo "</td>";
- #echo "<td bgcolor = '#ffffff'>";
- #echo "  ";
- echo number_format($MTDVARIANCE);
- #echo "</td>";
- #echo "<td bgcolor = '#ffffff'>";
- #echo "  ";
- echo number_format($MTDpercenttoGOAL,1);
- echo $MTDpercenttoGOALformatted;
- echo "%";
- #echo "</td></tr>";
- }
- #################################################
- # END OF DETAIL SECTION
- #################################################
- echo "<br>";
- }
- echo "<br>";
- echo "<br>";
- ?>
- </html>
Expand|Select|Wrap|Line Numbers
- #echo "<td bgcolor = '#ffffff'>";
- echo $REG;
- echo $FAC;
- #echo "</td>";
- #echo "<td bgcolor = '#ffffff'>";
- echo $HOSPNAME;
- #echo "</td>";
- #echo "<td bgcolor = '#ffffff'>";
- #echo "  ";
- echo number_format($MONTHLYGOAL);
- #echo "</td>";
- #echo "<td bgcolor = '#ffffff'>";
- #echo "  ";
- echo number_format($MTDCASH);
- #echo "</td>";
- #echo "<td bgcolor = '#ffffff'>";
- #echo "  ";
- echo number_format($MTDGOAL);
- #echo "</td>";
- #echo "<td bgcolor = '#ffffff'>";
- #echo "  ";
- echo number_format($MTDVARIANCE);
- #echo "</td>";
- #echo "<td bgcolor = '#ffffff'>";
- #echo "  ";
- echo number_format($MTDpercenttoGOAL,1);
- echo $MTDpercenttoGOALformatted;
- echo "%";
- #echo "</td></tr>";
thanks in advance,
geebee