コード例 #1
0
 function strActivelyEnrolledDuringMonthWhere(&$cprog, $lMonth, $lYear)
 {
     //---------------------------------------------------------------------
     // find the enrollees whose start date is before the end of the month
     // and whose inactive date is either null or after the first of the
     // month.
     //---------------------------------------------------------------------
     $lMaxDays = lDaysInMonth($lMonth, $lYear);
     $dteLastSecOfMonth = mktime(23, 59, 59, $lMonth, $lMaxDays, $lYear);
     $mdteLastSec = strPrepDateTime($dteLastSecOfMonth);
     $mdteFirstSec = strPrepDate(mktime(0, 0, 0, $lMonth, 1, $lYear));
     $strEFNPre = $cprog->strETableFNPrefix;
     $strDateStart = $strEFNPre . '_dteStart';
     $strDateEnd = $strEFNPre . '_dteEnd';
     return " AND ({$strDateStart} <= {$mdteLastSec})\n               AND (({$strDateEnd} IS NULL) OR ({$strDateEnd} >= {$mdteFirstSec})) \n";
 }
コード例 #2
0
function lDateDiff_DaysViaMDY($lEndMonth, $lEndDay, $lEndYear, $lStartMonth, $lStartDay, $lStartYear)
{
    //---------------------------------------------------------------------
    // created 2009-06-08 jpz
    //---------------------------------------------------------------------
    if ($lStartYear > $lEndYear || $lStartYear == $lEndYear && $lStartMonth > $lEndMonth || $lStartYear == $lEndYear && $lStartMonth == $lEndMonth && $lStartDay > $lEndDay) {
        screamForHelp('Start date must be on or before End date!<br>error on line ' . __LINE__ . ',<br>file ' . __FILE__ . ',<br>function ' . __FUNCTION__);
    }
    //----------------------------------------
    // special case - within the same month
    //----------------------------------------
    if ($lEndMonth == $lStartMonth && $lEndYear == $lStartYear) {
        return $lEndDay - $lStartDay;
    }
    //----------------------------------------
    // starting month days
    //----------------------------------------
    $lHoldDayCount = lDaysInMonth($lStartMonth, $lStartYear) - $lStartDay;
    $lLoopMonth = $lStartMonth + 1;
    $lLoopYear = $lStartYear;
    if ($lLoopMonth > 12) {
        $lLoopMonth = 1;
        ++$lLoopYear;
    }
    $lAbsLoopMonth = $lLoopYear * 12 + $lLoopMonth;
    $lAbsMonthEnd = $lEndYear * 12 + $lEndMonth;
    for ($idx = $lAbsLoopMonth; $idx < $lAbsMonthEnd; ++$idx) {
        $lHoldDayCount += lDaysInMonth($lLoopMonth, $lLoopYear);
        ++$lLoopMonth;
        if ($lLoopMonth > 12) {
            $lLoopMonth = 1;
            ++$lLoopYear;
        }
    }
    $lHoldDayCount += $lEndDay;
    return $lHoldDayCount;
}
コード例 #3
0
function strAttendanceTable(&$cprog, $attrib)
{
    //---------------------------------------------------------------------
    //
    //---------------------------------------------------------------------
    $lMaxDays = lDaysInMonth($attrib->lMonth, $attrib->lYear);
    $lNumERecs = $cprog->lNumERecs;
    if ($lNumERecs > 0) {
        $lATableID = $cprog->lAttendanceTableID;
        $strATable = $cprog->strAttendanceTable;
        $strAFNPrefix = $cprog->strATableFNPrefix;
        $lETableID = $cprog->lEnrollmentTableID;
        $attend = array();
        $idx = 0;
        foreach ($cprog->erecs as $erec) {
            $lERecID = $erec->lKeyID;
            $lClientID = $erec->lClientID;
            // load the enrollees
            $attend[$idx] = array();
            $attend[$idx][0] = strLinkView_ClientRecord($lClientID, 'View client record', true) . '&nbsp;' . str_pad($lClientID, 5, '0', STR_PAD_LEFT) . '&nbsp;&nbsp;' . '<b>' . htmlspecialchars($erec->strClientLName) . '</b>, ' . htmlspecialchars($erec->strClientFName);
            // enrollment link
            $attend[$idx][1] = strLinkView_CProgEnrollRec($lETableID, $lClientID, $lERecID, 'View Enrollment', true) . '&nbsp;' . str_pad($lERecID, 5, '0', STR_PAD_LEFT);
            // populate the attendance cells
            $strCheckImg = '<div style="display:inline-block; width: 100%; text-align: center;"><img src="' . DL_IMAGEPATH . '/misc/check06.gif"></div>';
            for ($jidx = 2; $jidx <= $lMaxDays + 1; ++$jidx) {
                if (bEnrolleeInAttendance($erec, $attrib->lMonth, $jidx - 1, $attrib->lYear)) {
                    $attend[$idx][$jidx] = $strCheckImg;
                    $strEntry = '';
                    arecIDXsViaERecDate($erec, $attrib->lMonth, $jidx - 1, $attrib->lYear, $lNumARecs, $arecIDX);
                    $lCnt = 1;
                    foreach ($arecIDX as $aIDX) {
                        $arecCurrent = $erec->arecs[$aIDX];
                        $lARecID = $arecCurrent->lKeyID;
                        if ($lNumARecs > 1) {
                            $strEntry .= '(' . $lCnt . ')<br>';
                            ++$lCnt;
                        }
                        if ($attrib->bALink) {
                            $strEntry .= strLinkView_CProgAttendRec($lATableID, $lClientID, $lARecID, 'View attendance record', true) . str_pad($lARecID, 5, '0', STR_PAD_LEFT) . '<br>';
                        }
                        if ($attrib->bDuration) {
                            $strEntry .= '<b>duration:</b> ' . number_format($arecCurrent->dDuration, 2) . 'hr<br>';
                        }
                        if ($attrib->bActivity) {
                            $strEntry .= '<b>activity:</b> ' . strShortenString($arecCurrent->strActivity, 25, true) . '<br>';
                        }
                        if ($attrib->bCNotes) {
                            $strEntry .= '<b>case notes:</b> ' . strShortenString($arecCurrent->strCaseNotes, 25, true) . '<br>';
                        }
                    }
                    if ($strEntry != '') {
                        $attend[$idx][$jidx] .= '<br>' . $strEntry;
                    }
                } else {
                    $attend[$idx][$jidx] = '&nbsp;';
                }
            }
            ++$idx;
        }
    }
    // build the html table
    $strOut = '
          <div id="attendTable" style="width: 100%; overflow: auto; ">
          <table class="enpRpt">
             <tr>
                <td class="enpRptTitle" colspan="' . ($lMaxDays + 2) . '">' . htmlspecialchars($cprog->strSafeAttendLabel) . ': ' . htmlspecialchars($cprog->strProgramName) . '
                </td>
             </tr>
             <tr>
                <td class="enpRptLabel" rowspan="2" style="vertical-align: bottom;">Enrollee</td>
                <td class="enpRptLabel" rowspan="2" style="vertical-align: bottom;">Enrollment<br>Record</td>
                <td class="enpRptLabel" colspan="' . $lMaxDays . '" style="text-align: center; vertical-align: middle; font-size: 12pt;">' . $attrib->strLinkPrev . strXlateMonth($attrib->lMonth) . ' ' . $attrib->lYear . $attrib->strLinkNext . '</td></tr><tr>' . "\n";
    for ($jidx = 1; $jidx <= $lMaxDays; ++$jidx) {
        $strOut .= '<td class="enpRptLabel" style="text-align: center;">&nbsp;' . $jidx . '&nbsp;</td>' . "\n";
    }
    $strOut .= '</tr>' . "\n";
    for ($idx = 0; $idx < $lNumERecs; ++$idx) {
        $strOut .= '<tr class="makeStripe">' . "\n";
        $strOut .= '<td class="enpRpt" style="width: 170pt;" nowrap>' . $attend[$idx][0] . '</td>' . "\n";
        for ($jidx = 1; $jidx <= $lMaxDays + 1; ++$jidx) {
            $strOut .= '<td class="enpRpt" style="font-size: 8pt;" nowrap>' . $attend[$idx][$jidx] . '</td>' . "\n";
        }
        $strOut .= '</tr">' . "\n";
    }
    $strOut .= '</table></div>';
    return $strOut;
}