begin_date, end_date, preparedby, uploaddate, active,  */
 /*table 2: bgtfiletasks. columns: taskidx, bgtfileidx, m_stasks, tasks, 
   date_start, date_end, nomths, hours,  */
 /*table 3: bgtfileresource. columns: bgtrscidx, bgtfileidx, email_name, title, level, hrateus,  */
 /*table 4: bgtfileres_task_hr. columns: rthidx, taskidx, bgtrscidx, hours,  */
 //echo $sql."<br><br><br>";
 $result = mysql_query($sql);
 include "err_msg.inc";
 $oneprojbudget = 0;
 while (list($tskdateS, $tskdateE, $nomths, $hours) = mysql_fetch_array($result)) {
     //$casethismth || $caselastmth || $caseyear || $caselastyear || $caseany)
     $hrsinmth = $hours / $nomths;
     if ($casethismth || $caselastmth) {
         $oneprojbudget += $hrsinmth;
     } else {
         $thispod = calhours($tskdateS, $tskdateE, $hrsinmth);
         $oneprojbudget += $thispod;
         //echo "$tskdateS, $tskdateE, $nomths, $hours, $thispod<br>";
     }
 }
 //echo "$oneprojbudget<br>";
 //list($oneprojbudget) = mysql_fetch_array($result);
 if ($oneprojactual || $oneprojbudget) {
     $noctr++;
     $allstafftotalactual += $oneprojactual;
     $allstafftotalbudget += $oneprojbudget;
     $no1 = sprintf("%01.2f", $oneprojactual / 60.0);
     $no2 = sprintf("%01.2f", $oneprojbudget);
     $oneprojactual = number_format($oneprojactual / 60.0, 2);
     $oneprojbudget = number_format($oneprojbudget, 2);
     $extra = "&datefrom={$datefrom}&dateto={$dateto}&ename={$ename}&fname={$fname}&rpttitle={$title}";
Esempio n. 2
0
    $result = mysql_query($sql);
    include "err_msg.inc";
    $noentry = 0;
    $hrspod = 0;
    $hrstotal = 0;
    while (list($tskdateS, $tskdateE, $nomths, $tasks, $hours) = mysql_fetch_array($result)) {
        if (!$noentry) {
            echo "<h3>{$brief_code} {$timeframe}</h3>";
            fputs($csvfh, "{$brief_code}\n");
            echo "<table border=1>";
            echo "<tr><th>Tasks</th><th>From</th><th>To</th><th>Month</th><th>Hours for the Period</th><th>Total Hours</th></tr>";
            fputs($csvfh, "Tasks,From,To,Month,Hours for the Period,Total Hours\n");
        }
        $noentry++;
        $hrsinmth = $hours / $nomths;
        $hrs = calhours($tskdateS, $tskdateE, $hrsinmth);
        $podhours = number_format($hrs, 2);
        $hrspod += $hrs;
        $hrstotal += $hours;
        echo "<tr><td>{$tasks}</td><td>{$tskdateS}</td><td>{$tskdateE}</td><td align=middle>{$nomths}</td>\n\t\t\t\t\t<td align=middle>{$podhours}</td><td align=middle>{$hours}</td></tr>";
        fputs($csvfh, "{$tasks},{$tskdateS},{$tskdateE},{$nomths},{$podhours},{$hours}\n");
    }
    if ($noentry) {
        $hrspod = number_format($hrspod, 2);
        $hrstotal = number_format($hrstotal, 2);
        echo "<tr><th colspan=4>Sub Total</th>\n\t\t\t\t\t<th>{$hrspod}</th><th>{$hrstotal}</th></tr>";
        fputs($csvfh, ",,,,{$hrspod},{$hrstotal}\n");
        echo "</table><p>";
    }
}
if (!$hrstotal) {