473,387 Members | 1,569 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

table rows

hi,

i have the following:

Expand|Select|Wrap|Line Numbers
  1. <html>
  2.  
  3.  
  4. <STYLE type="text/css">
  5.         TD{font-family:ARIAL;font-size:11px;color:#666666;}
  6.         BODY{font-family:ARIAL;font-size:11px;color:#666666;background-color:#eeeeee;margin-top:40px;margin-bottom:0px;margin-left:40px;margin-right:0px;}
  7.         FORM{display:inline;}    
  8.         A:LINK, A:VISITED{color:#6699cc;text-decoration:none;}
  9.         A:HOVER{text-decoration:underline;color:#CCCCCC;}
  10.         .HOMETEXT{font-size:14px;}
  11.         .ITEMNAME{font-size:14px;font-weight:BOLD;}
  12.         /*.WHITELINK{color:#ffffff;font-size:10px;}*/
  13.         .INPUT{border-color:#66CCFF;border-width:1px;border-style:solid;background-color:#eeeeee;font-size:10px;}
  14.         .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;}
  15.         .BUTTON{border-color:#99CCFF;border-width:1px;border-style:solid;}
  16.         .BOLD{color:#666666;font-family:Arial, Tahoma, Helvetica, sans-serif;font-size:8pt;font-weight:BOLD;}
  17.         .BOLDLARGE{color:#666666;font-size:12pt;font-weight:BOLD;}
  18.         .CURRENTPAGE{color:#666666;font-size:8pt;font-weight:BOLD;}
  19.         .ERROR{color:#cc0033;font-size:8pt;font-weight:BOLD;}
  20.         .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;}
  21.         .MENUCELLSTART{height:24px;width:80px;border:1px solid #BBBBBB;text-align:center;font-weight:BOLD;color:#FFFFFF;}
  22.         .SPACE1{padding-left:20px;}
  23.         .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;}
  24.         .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;}
  25.         .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;}
  26.         .BORDER1{border-bottom:1px solid #BBBBBB;}
  27.         .BORDER2{background-color:#EEEEEE;color:#666666;border:1px solid #BBBBBB;}
  28.         .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;}
  29.         .HEADER{background-color:#EEEEEE;color:#666666;border:1px solid #BBBBBB;height:24px;font-weight:BOLD;padding-left:20px;}
  30.         .PRODCELL{border-left:1px solid #BBBBBB;border-bottom:1px solid #BBBBBB;background-color:#FFFFFF;}
  31.         .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;}
  32.         .HEADER5{width:130px;color:#666666;background-color:#EEEEEE;border-top:1px solid #BBBBBB;border-right:1px solid #BBBBBB;height:24px;}
  33.         .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;}
  34.         .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;}
  35.         .PRODIMGSM{border:1px solid white;height:120px;width:120px;align:middle;}
  36.         .PRODIMGLG{border:1px solid #BBBBBB;height:290px;width:290px;align:middle;}
  37.         .CATIMG{width:120px;height:120px;border:1px solid #BBBBBB;}
  38.         .stylegreyblue {color: #669999}
  39.         .stylelightblue {color: ##DEE7F7}
  40.         .styleblack {color:#000000}
  41.         .stylegreyblack {color:#444444}
  42.         .styledarkpink {color: #990033}
  43.         .styleslateblue {color: #008b8b}
  44.         .stylewhite {color: #ffffff}
  45.         .input.btn {color:#666666; font: bold small 'trebuchet ms',helvetica,sans-serif; 
  46.         background-color: #eeeeee;
  47.         border:1px solid;   
  48.         border-color: #66CCFF #66CCFF #66CCFF #66CCFF; 
  49.         font-size:11px; 
  50.         }  
  51.  
  52.  
  53. .style17 {color: #666666}
  54. .stylelightsteelblue {color: #BOC4DE}
  55. .stylenewgrey {color: #D1D1D1}
  56. .style18 {color: #CC6699}
  57. .style19 {color: #CCCCCC}
  58. .style22 {font-family: Verdana; color: #CCCCCC;}
  59. .style23 {color: #66CCFF}
  60. .style24 {
  61.     color: #99FF66;
  62.     font-weight: bold;
  63. }
  64. .style26 {color: #99FF66}
  65. .style27 {color: #999999}
  66. .stylered {color: #FF0000}
  67. .stylegreen {color: #00FF00}
  68. .CONIFERCOLOR {color: #660000}
  69.  
  70. </STYLE>
  71.  
  72. </head>
  73.  
  74.  
  75.  
  76.  
  77.  
  78.  
  79.  
  80.  
  81.  
  82.  
  83. <BODY>
  84.  
  85.  
  86.  
  87. <?php
  88. // script dies after 120 secs
  89. set_time_limit(120);
  90. ?>
  91.  
  92.  
  93.  
  94. <br>
  95. <br>
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106. <?php
  107. //The function returns the no. of business days between two dates and it skips the holidays
  108. function getWorkingDays($startDate,$endDate,$holidays){
  109.     //The total number of days between the two dates. We compute the no. of seconds and divide it to 60*60*24
  110.     //We add one to inlude both dates in the interval.
  111.     $days = (strtotime($endDate) - strtotime($startDate)) / 86400; //used for calculating elapsed bus. days
  112.     //$days2 = (strtotime($endDate) - strtotime($startDate)) / 86400 + 1; //used for calculating business days
  113.  
  114.     $no_full_weeks = floor($days / 7);
  115.     $no_remaining_days = fmod($days, 7);
  116.  
  117.  
  118.     //It will return 1 if it's Monday,.. ,7 for Sunday
  119.     $the_first_day_of_week = date("N",strtotime($startDate));
  120.     $the_last_day_of_week = date("N",strtotime($endDate));
  121.  
  122.     //---->The two can be equal in leap years when february has 29 days, the equal sign is added here
  123.     //In the first case the whole interval is within a week, in the second case the interval falls in two weeks.
  124.     if ($the_first_day_of_week <= $the_last_day_of_week){
  125.         if ($the_first_day_of_week <= 6 && 6 <= $the_last_day_of_week) $no_remaining_days--;
  126.         if ($the_first_day_of_week <= 7 && 7 <= $the_last_day_of_week) $no_remaining_days--;
  127.     }
  128.     else{
  129.         if ($the_first_day_of_week <= 6) {
  130.         //In the case when the interval falls in two weeks, there will be a Sunday for sure
  131.             $no_remaining_days--;
  132.         }
  133.     }
  134.  
  135.     //The no. of business days is: (number of weeks between the two dates) * (5 working days) + the remainder
  136. //---->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
  137.    $workingDays = $no_full_weeks * 5;
  138.     if ($no_remaining_days > 0 )
  139.     {
  140.       $workingDays += $no_remaining_days;
  141.     }
  142.  
  143.     //We subtract the holidays
  144.     foreach($holidays as $holiday){
  145.         $time_stamp=strtotime($holiday);
  146.         //If the holiday doesn't fall in weekend
  147.         if (strtotime($startDate) <= $time_stamp && $time_stamp <= strtotime($endDate) && date("N",$time_stamp) != 6 && date("N",$time_stamp) != 7)
  148.             $workingDays--;
  149.     }
  150.  
  151.     return $workingDays;
  152. }
  153. ?>
  154.  
  155.  
  156.  
  157.  
  158.  
  159.  
  160.  
  161.  
  162.  
  163.  
  164.  
  165.  
  166. <?php
  167.   $i = 1;
  168.   //get timestamp for past/future date I want
  169.   $pf_time = strtotime("-".$i." day");
  170.   //format the date using the timestamp generated
  171.   $previous_day = date("d M Y", $pf_time);
  172. ?>
  173.  
  174.  
  175.  
  176.  
  177. <?php
  178. $holidays=array("25 Dec 2008","26 Dec 2008","16 Feb 2009");
  179. $days_in_month = date("t"); 
  180. $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
  181.  
  182. echo "elapsed business days:";
  183. echo $elapsed_business_days;
  184.  
  185.  
  186. ?>
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195. <?php
  196. #**********************************************************************************
  197.  
  198. //The function returns the no. of business days between two dates and it skips the holidays
  199. function getWorkingDaysTOT($startDate2,$endDate2,$HOLS){
  200.     //The total number of days between the two dates. We compute the no. of seconds and divide it to 60*60*24
  201.     //We add one to inlude both dates in the interval.
  202.     $days2 = (strtotime($endDate2) - strtotime($startDate2)) / 86400+1; //used for calculating elapsed bus. days
  203.  
  204.     $no_full_weeks2 = floor($days2 / 7);
  205.     $no_remaining_days2 = fmod($days2, 7);
  206.  
  207.  
  208.     //It will return 1 if it's Monday,.. ,7 for Sunday
  209.     $the_first_day_of_week2 = date("N",strtotime($startDate2));
  210.     $the_last_day_of_week2 = date("N",strtotime($endDate2));
  211.  
  212.     //---->The two can be equal in leap years when february has 29 days, the equal sign is added here
  213.     //In the first case the whole interval is within a week, in the second case the interval falls in two weeks.
  214.     if ($the_first_day_of_week2 <= $the_last_day_of_week2){
  215.         if ($the_first_day_of_week2 <= 6 && 6 <= $the_last_day_of_week2) $no_remaining_days2--;
  216.         if ($the_first_day_of_week2 <= 7 && 7 <= $the_last_day_of_week2) $no_remaining_days2--;
  217.     }
  218.     else{
  219.         if ($the_first_day_of_week2 <= 6) {
  220.         //In the case when the interval falls in two weeks, there will be a Sunday for sure
  221.             $no_remaining_days2--;
  222.         }
  223.     }
  224.  
  225.     //The no. of business days is: (number of weeks between the two dates) * (5 working days) + the remainder
  226. //---->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
  227.    $workingDays2 = $no_full_weeks2 * 5;
  228.     if ($no_remaining_days2 > 0 )
  229.     {
  230.       $workingDays2 += $no_remaining_days2;
  231.     }
  232.  
  233.  
  234.  
  235.  
  236.     //We subtract the holidays
  237.     foreach($HOLS as $HOL){
  238.         $time_stamp2=strtotime($HOL);
  239.         //If the holiday doesn't fall in weekend
  240.         if (strtotime($startDate2) <= $time_stamp2 && $time_stamp2 <= strtotime($endDate2) && date("N",$time_stamp2) != 6 && date("N",$time_stamp2) != 7)
  241.             $workingDays2--;
  242.     }
  243.  
  244.     return $workingDays2;
  245.  
  246. }
  247.  
  248. ?>
  249.  
  250.  
  251.  
  252.  
  253.  
  254.  
  255. <?php
  256.   $c = 1;
  257.   //get timestamp for past/future date I want
  258.   $pf_time2 = strtotime("-".$c." day");
  259.   //format the date using the timestamp generated
  260.   $previous_day2 = date("d M Y", $pf_time2);
  261. ?>
  262.  
  263.  
  264.  
  265.  
  266. <?php
  267. $HOLS=array("25 Dec 2008","26 Dec 2008","16 Feb 2009");
  268.  
  269. #echo getWorkingDaysTOT("2009-02-15","2009-02-21",$HOLS);
  270. ?>
  271.  
  272.  
  273.  
  274.  
  275.  
  276. <?php
  277. $days_in_month2 = date("t"); 
  278. $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
  279. $business_days2 = getWorkingDaysTOT(date("1 M Y"),date("$days_in_month2 M Y"),$HOLS);
  280. ?>
  281.  
  282.  
  283. <?php
  284. /*
  285. function destroy_foo() 
  286. {
  287.     global $foo;
  288.     unset($foo);
  289. }
  290.  
  291. $foo = $business_days2;
  292. destroy_foo();
  293. echo "<br>";
  294. echo "this is FOO:";
  295. echo $foo;
  296. */
  297. ?>
  298.  
  299.  
  300. <?php
  301. echo "<br>";
  302. echo "business days:";
  303. echo $business_days2;
  304.  
  305. #**********************************************************************************
  306. ?>
  307.  
  308.  
  309.  
  310.  
  311.  
  312.  
  313.  
  314.  
  315.  
  316. <?php
  317. echo "<br><br>";
  318. print "<span style='color: #660000; font-size: 8pt; font-family: arial'>";
  319. echo "<b>";
  320. echo"Conifer Operational Cash<br>";
  321. echo "</b>";
  322. print "</span>";
  323.  
  324.  
  325.  
  326. #################################################
  327. #DETAIL SECTION
  328. #################################################
  329. $conn=odbc_connect('DAILYCASH','','');
  330. if (!$conn)
  331.   {exit("Connection Failed: " . $conn);}
  332.  
  333.  
  334.  
  335.  
  336. $sqlREGION="SELECT DISTINCT Region FROM qry_ttlPAYMENTS";
  337. $rsREGION=odbc_exec($conn,$sqlREGION);
  338. while (odbc_fetch_row($rsREGION))
  339. {
  340. $REG=odbc_result($rsREGION, Region);
  341.  
  342. #echo "<tr>";
  343. #echo "<tr>";
  344.  
  345. echo "<br>";
  346. echo $REG;
  347. #echo "</tr>";
  348. #echo "<br>";
  349.  
  350.  
  351.  
  352.  
  353. #$sql="SELECT TRCFAC, TTLPAYMENTS as TTL FROM qry_ttlPAYMENTS WHERE TRCFAC = 'JON'";
  354. $sql="SELECT TRCFAC, TTLPAYMENTS as TTL FROM qry_ttlPAYMENTS WHERE Region ='".$REG."'";
  355. $rs=odbc_exec($conn,$sql);
  356.  
  357.  
  358.  
  359.  
  360. #print "<br>";
  361. if (!$rs)
  362.   {exit("Error in SQL");}
  363. while (odbc_fetch_row($rs))
  364. {
  365.  
  366.      $FAC=odbc_result($rs, TRCFAC);
  367.       $MTDCASH=odbc_result($rs, TTL);
  368.  
  369. $sql2="SELECT fac, hospname, ttl FROM qry_goals WHERE fac ='".$FAC."'";
  370. $rs2=odbc_exec($conn,$sql2);
  371.  
  372.     $MONTHLYGOAL=odbc_result($rs2, ttl);
  373.     $HOSPNAME=odbc_result($rs2, hospname);
  374.  
  375. $MTDGOAL = +$MONTHLYGOAL/$business_days2 * $elapsed_business_days;
  376. $MTDVARIANCE = $MTDCASH - $MTDGOAL;
  377.  
  378. if($MTDGOAL == '0')
  379. {
  380. $MTDpercenttoGOAL =0;
  381. #echo "MTD goal is ZERO";
  382. }
  383. elseif($MTDCASH == '0')
  384. {
  385. #echo "MTD CASH IS ZERO";
  386. $MTDpercenttoGOAL =0;
  387. }
  388. else
  389. {
  390. #echo "ALL GOOD";
  391. $MTDpercenttoGOAL = +$MTDCASH/$MTDGOAL * 100;
  392. $MTDpercenttoGOALformatted = sprintf("%%",$MTDpercenttoGOAL);
  393. }
  394.  
  395.  
  396. echo "<br>";
  397.  
  398.  
  399. #echo "<td bgcolor = '#ffffff'>";
  400. echo $REG;
  401. echo $FAC;
  402. #echo "</td>";
  403. #echo "<td bgcolor = '#ffffff'>";
  404. echo $HOSPNAME;
  405. #echo "</td>";
  406. #echo "<td bgcolor = '#ffffff'>";
  407. #echo "&nbsp&nbsp";
  408. echo number_format($MONTHLYGOAL);
  409. #echo "</td>";
  410. #echo "<td bgcolor = '#ffffff'>";
  411. #echo "&nbsp&nbsp";
  412. echo number_format($MTDCASH);
  413. #echo "</td>";
  414. #echo "<td bgcolor = '#ffffff'>"; 
  415. #echo "&nbsp&nbsp";
  416. echo number_format($MTDGOAL);
  417. #echo "</td>";
  418. #echo "<td bgcolor = '#ffffff'>";
  419. #echo "&nbsp&nbsp";
  420. echo number_format($MTDVARIANCE);
  421. #echo "</td>";
  422. #echo "<td bgcolor = '#ffffff'>";
  423. #echo "&nbsp&nbsp";
  424. echo number_format($MTDpercenttoGOAL,1);
  425. echo $MTDpercenttoGOALformatted;
  426. echo "%";
  427. #echo "</td></tr>";
  428.  
  429.  
  430.  
  431. }
  432. #################################################
  433. # END OF DETAIL SECTION
  434. #################################################
  435.  
  436.  
  437.  
  438.  
  439.  
  440.  
  441.  
  442.  
  443. echo "<br>";
  444. }
  445.  
  446.  
  447. echo "<br>";
  448. echo "<br>";
  449.  
  450. ?>
  451.  
  452.  
  453.  
  454. </html>
  455.  
trying to figure out how to put the $REG, FAC, etc. information... as denoted by the following part of the code:
Expand|Select|Wrap|Line Numbers
  1. #echo "<td bgcolor = '#ffffff'>";
  2. echo $REG;
  3. echo $FAC;
  4. #echo "</td>";
  5. #echo "<td bgcolor = '#ffffff'>";
  6. echo $HOSPNAME;
  7. #echo "</td>";
  8. #echo "<td bgcolor = '#ffffff'>";
  9. #echo "&nbsp&nbsp";
  10. echo number_format($MONTHLYGOAL);
  11. #echo "</td>";
  12. #echo "<td bgcolor = '#ffffff'>";
  13. #echo "&nbsp&nbsp";
  14. echo number_format($MTDCASH);
  15. #echo "</td>";
  16. #echo "<td bgcolor = '#ffffff'>"; 
  17. #echo "&nbsp&nbsp";
  18. echo number_format($MTDGOAL);
  19. #echo "</td>";
  20. #echo "<td bgcolor = '#ffffff'>";
  21. #echo "&nbsp&nbsp";
  22. echo number_format($MTDVARIANCE);
  23. #echo "</td>";
  24. #echo "<td bgcolor = '#ffffff'>";
  25. #echo "&nbsp&nbsp";
  26. echo number_format($MTDpercenttoGOAL,1);
  27. echo $MTDpercenttoGOALformatted;
  28. echo "%";
  29. #echo "</td></tr>";
  30.  
into table rows after each major $REG section.

thanks in advance,
geebee
Feb 23 '09 #1
0 1461

Sign in to post your reply or Sign up for a free account.

Similar topics

61
by: Toby Austin | last post by:
I'm trying to replace <table>s with <div>s as much as possible. However, I can't figure out how to do the following… <table> <tr> <td valign="top" width="100%">some data that will...
4
by: jeffsal | last post by:
I am using sorttable.js to sort a table which works fine which allows a user to sort the table by clicking on the column header. Is there some code I could add to the page (onload or something) to...
33
by: Geoff Jones | last post by:
Hiya I have a DataTable containing thousands of records. Each record has a primary key field called "ID" and another field called "PRODUCT" I want to retrieve the rows that satisy the following...
6
by: Ward Germonpré | last post by:
Hi, I have a reference to a dom table. How can I retrieve the number of columns in that table ? The stop value below doesn't work, nor did my experimenting with tbodies and childNodes.. .......
8
by: johkar | last post by:
I would like to ensure this script is optimized (runs correctly or does not execute) for the major browsers. Will checking getElementById and getElementsByTagName accomplish this? In addition,...
7
by: Kamal | last post by:
Hello all, I have a very simple html table with collapsible rows and sorting capabilities. The collapsible row is hidden with css rule (display:none). When one clicks in the left of the...
0
by: Romulo NF | last post by:
Greetings again everyone Recently i´ve been asked to develop a script to allow filtering in the content of the table, with dinamic options based on the own content. Example: a table with the name of...
6
by: Romulo NF | last post by:
Greetings again to everyone, Im back to show this grid componenet i´ve developed. With this grid you can show the data like a normal table, remove the rows that you need, add rows, import data,...
1
by: rakeshnair | last post by:
i wrote a code in jsp to create dynamic table..the problem is i need data base connection when cursor moves from one cell to other... eg...when i enter product id in the first cell, the product name...
5
by: jrod11 | last post by:
hi, I found a jquery html table sorting code i have implemented. I am trying to figure out how to edit how many colums there are, but every time i remove code that I think controls how many colums...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.