コード例 #1
0
    function renewMember($option, $transaction, $member, $memberCredits)
    {
        JHTML::_('behavior.calendar');
        ?>
	<form action="index.php" method="post" name="adminForm" id="adminForm">
	<fieldset class="adminform">
	<legend>Membership Renewal</legend>
	<table class="admintable">
	<tr>
	<tr>
		<td width="100" align="right" class="key">
			Member Name:
		</td>
		<td>
			<?php 
        echo $member->nameFirst . " " . $member->nameLast;
        ?>
			<input type="hidden" name="memberID" id="memberID" value="<?php 
        echo $member->id;
        ?>
">
		</td>
	</tr>
	<tr>
		<td width="100" align="right" class="key">
			Member Credits Available:
		</td>
		<td>
			<?php 
        echo sprintf("%.2F", $memberCredits);
        ?>
		</td>
	</tr>
	<tr>
		<td width="100" align="right" class="key">
			Member Expiration:
		</td>
		<td>
			<?php 
        echo $member->membershipExpire;
        ?>
		</td>
	</tr>

	<tr>
		<td width="100" align="right" class="key">
		Transaction Time:
		</td>
		<td>
			<?php 
        echo $transaction->dateOpen;
        ?>
			<input type="hidden" name="dateOpen" id="dateOpen" value="<?php 
        echo $transaction->dateOpen;
        ?>
">
			<input type="hidden" name="dateClosed" id="dateClosed" value="<?php 
        echo $transaction->dateClosed;
        ?>
">
		</td>
	</tr>
	<tr>
		<td class="key">Transaction Type</td>
		<td>Renew Member<input type="hidden" name="type" id="type" value="1003"></td>
	</tr>
	<tr>
		<td class="key">Credits</td>
		<td><input name="credits" id="credits" value="<?php 
        echo $transaction->credits;
        ?>
"></td>
	</tr>
	<tr>
		<td class="key">Cash</td>
		<td><input name="cash" id="cash" value="<?php 
        echo $transaction->cash;
        ?>
"></td>
	</tr>
	<tr>
		<td class="key">Membership term (starts now or on the expire date, whichever is later)</td>
		<td><?php 
        HTML_cbodb::dropdownFromArray("term", HTML_cbodb::$memberRenewalTermArray, 366);
        ?>
</td>
	</tr>
	<tr>
		<td class="key">Comment</td>
		<td><input name="comment" id="comment" value="<?php 
        echo $transaction->comment;
        ?>
" size="100"></td>
	</tr>
	</table>
	</fieldset>
	<input type="hidden" name="id" value="<?php 
        echo $transaction->id;
        ?>
" />
	<input type="hidden" name="option" value="<?php 
        echo $option;
        ?>
" />
	<input type="hidden" name="task" value="save" />
	<input type="hidden" name="cbodb_mode" value="transaction" />
	</form>
	<?php 
    }
コード例 #2
0
ファイル: cbodb.php プロジェクト: reeleis/ohiocitycycles
function saveClass($option)
{
    global $mainframe;
    $postrow = JRequest::get('post');
    $classID = $postrow[classID];
    if ($classID == 0) {
        $loggedin = CbodbMember::loggedInList(TRUE);
        HTML_cbodb::startClass($option, $loggedin, $postrow[memberID], "You must select a class!");
    } else {
        if ($postrow[classdate][day] == 0 && $postrow[startsnow] != 'on') {
            $loggedin = CbodbMember::loggedInList(TRUE);
            HTML_cbodb::startClass($option, $loggedin, $postrow[memberID], "You must select a date or choose 'today'!");
        } else {
            recordClass($postrow[memberID], $postrow[classID], strcmp($postrow[startsnow], "on") ? 0 : 1, $postrow[classdate], $postrow[duration], $postrow[students]);
            $mainframe->redirect('index.php?option=' . $option . '&task=shop&key=3b767559374f5132236f6e68256b2529#top', 'Class data recorded, thank you!');
        }
    }
}
コード例 #3
0
function showStaffTotals($option)
{
    // Show hours logged for all staff transactions,
    // and commissions for Al
    $db =& JFactory::getDBO();
    global $mainframe;
    $curYear = date('Y');
    $curMonth = date('m');
    $lastDayInMonth = date('t');
    $dateStartDefault = "{$curYear}-{$curMonth}-01";
    $dateEndDefault = "{$curYear}-{$curMonth}-{$lastDayInMonth}";
    // not working w/ this php version?
    //$dateStartDefault = date("Y-m-d", strtotime("first day of this month"));
    //$dateEndDefault = date("Y-m-d", strtotime("first day of next month"));
    $dateStart = $mainframe->getUserStateFromRequest($option . '.staff.dateStart', 'dateStart', $dateStartDefault, 'string');
    $dateEnd = $mainframe->getUserStateFromRequest($option . '.staff.dateEnd', 'dateEnd', $dateEndDefault, 'string');
    if ($dateStart == "") {
        $dateStart = $dateStartDefault;
    }
    if ($dateEnd == "") {
        $dateEnd = $dateEndDefault;
    }
    $dateStart = date('Y-m-d', strtotime($dateStart));
    $dateEnd = date('Y-m-d', strtotime($dateEnd));
    // Look up all staff hours logged this period, by user
    $queryHours = "SELECT\n      t.memberID,\n      m.nameFirst,\n      m.nameLast,\n      SUM(t.totalTime) AS totalTimeSeconds,\n      COUNT(*) AS clockins,\n      MAX( t.totalTime ) AS longestClockIn,\n      AVG( t.totalTime ) AS avgClockIn\n    FROM\n      #__cbodb_transactions t,\n      #__cbodb_members m\n    WHERE\n      t.type = 4 AND\n      t.dateOpen >= '{$dateStart} 00:00:00' AND\n      t.dateOpen <= '{$dateEnd} 23:59:59' AND\n      t.memberID = m.id\n    GROUP BY\n      t.memberID\n    ORDER BY\n      m.nameLast, m.nameFirst ASC";
    $db->setQuery($queryHours);
    $rowsHours = $db->loadObjectList();
    if ($db->getErrorNum()) {
        echo $db->stderr();
        return false;
    }
    // Look up all commissions earned this period, by user
    // Right now just getting Al's, since that's all we seem to care about
    $queryCommissions = "SELECT\n \tcommissionUserID,\n \tnameFirst,\n \tnameLast,\n \tSUM(cash) AS commissionCash,\n \tSUM(credits) AS commissionCredits\n FROM\n\t((SELECT\n\t      i.commissionUserID AS commissionUserID,\n\t      m.nameFirst AS nameFirst,\n\t      m.nameLast AS nameLast,\n\t\t t.cash AS cash,\n\t\t t.credits AS credits\n\t    FROM\n\t      #__cbodb_transactions t,\n\t      #__cbodb_items i,\n\t      #__cbodb_members m\n\t    WHERE\n\t      t.type = 1001 AND\n\t      i.commissionUserID <> 0 AND\n\t      t.itemID = i.tag AND\n\t      t.dateOpen >= '{$dateStart} 00:00:00' AND\n\t      t.dateOpen <= '{$dateEnd} 23:59:59' AND\n\t      m.id = i.commissionUserID) ct)\n\tGROUP BY commissionUserID";
    $db->setQuery($queryCommissions);
    $rowsCommissions = $db->loadObjectList();
    if ($db->getErrorNum()) {
        echo $db->stderr();
        return false;
    }
    // Merge commissions rows into hours rows
    foreach ($rowsCommissions as $cRow) {
        $found = false;
        $hRowIndex = 0;
        foreach ($rowsHours as $hRow) {
            if ($hRow->memberID == $cRow->commissionUserID) {
                $found = true;
                break;
            } else {
                $hRowIndex++;
            }
        }
        if (!$found) {
            // Member with commissions doesn't have staff hours: add them
            $hRowIndex = count($rowsHours);
            $rowsHours[$hRowIndex] = new stdClass();
            $rowsHours[$hRowIndex]->memberID = $cRow->commissionUserID;
            $rowsHours[$hRowIndex]->nameFirst = $cRow->nameFirst;
            $rowsHours[$hRowIndex]->nameLast = $cRow->nameLast;
        }
        $rowsHours[$hRowIndex]->commissionCash = $cRow->commissionCash;
        $rowsHours[$hRowIndex]->commissionCredits = $cRow->commissionCredits;
    }
    HTML_cbodb::showStaffTotals($option, $rowsHours, $dateStart, $dateEnd);
}
コード例 #4
0
ファイル: cbodb.html.php プロジェクト: reeleis/ohiocitycycles
    function startClass($option, $rows, $memberID, $error = NULL)
    {
        ?>
<h1>Starting class</h1>
		<?php 
        if ($error) {
            echo '<h2 style="color: red;">ERROR: ' . $error . '</h2>';
        }
        ?>
		<form action="index.php#top" method="post" name="classForm">
  		<input type="hidden" name="option" value="<?php 
        echo $option;
        ?>
" />
  		<input type="hidden" name="task" value="saveclass" />
		<input type="hidden" name="memberID" value="<?php 
        echo $memberID;
        ?>
" />
		<?php 
        echo '<h2>Class:</h2>';
        HTML_cbodb::dropdownFromArray(classID, HTML_cbodb::$cbodb_classtypes, 0);
        echo '<p><br>Class length: <input type="text" value="2" name="duration" size="5"> hours<br>';
        echo '<h2>Date:</h2>';
        echo 'Today? <input type="checkbox" name="startsnow"> (or leave unchecked and enter a date below)';
        echo '<p>
		<select name="classdate[year]">
		<option value="2003">2003</option>
		<option value="2004">2004</option>
		<option value="2005">2005</option>
		<option value="2006">2006</option>
		<option value="2007">2007</option>
		<option selected value="2008">2008</option>
		<option value="2009">2009</option>
		<option value="2010">2010</option>
		<option value="2011">2011</option>
		<option value="2012">2012</option>
		</select>&nbsp;';
        echo '<SELECT NAME="classdate[month]">
<OPTION value="1">Jan</OPTION>
<OPTION value="2">Feb</OPTION>
<OPTION value="3">Mar</OPTION>
<OPTION value="4">Apr</OPTION>
<OPTION value="5">May</OPTION>
<OPTION value="6">Jun</OPTION>
<OPTION value="7">Jul</OPTION>
<OPTION value="8">Aug</OPTION>
<OPTION value="9">Sep</OPTION>
<OPTION value="10">Oct</OPTION>
<OPTION value="11">Nov</OPTION>
<OPTION value="12">Dec</OPTION>
</SELECT>&nbsp';
        echo '<select name="classdate[day]">';
        for ($day = 0; $day < 32; $day++) {
            echo "<option value=\"{$day}\">{$day}</option>";
        }
        echo '</select>';
        echo '
		<h2>Students:</h2>
		(Uncheck box for students not taking this class)<br><br>
		<table class="loggedInList">
		<tr><th></th><th width="150px">Name</th><th>Since</th><th width="80px">Credits</th><th width="80px">Member</th><th>Paid Cash</th><th>Paid Credits</th></tr>';
        $timezone = new DateTimeZone(getConfigValue("timeZone"));
        foreach ($rows as $row) {
            if ($row->type == 3) {
                //  John Mikolich   December 30, 2010
                //  See my other comments from today regarding the
                //  hard-coded 'UTC'.
                //  $dateOpen = new DateTime($row->dateOpen,new DateTimeZone("UTC"));
                $dateOpen = new DateTime($row->dateOpen, new DateTimeZone(getConfigValue("timeZone")));
                date_timezone_set($dateOpen, $timezone);
                echo '<tr>';
                echo '<td><input type="checkbox" name="students[' . $row->id . '][inclass]" id="inclass"></td>';
                echo '<td>' . $row->nameFirst . " " . $row->nameLast . '</td>
                            <td>' . date_format($dateOpen, "n/d/Y H:i") . '</td>
                            <td>&nbsp;&nbsp;' . sprintf("%.2F", CbodbTransaction::getMemberCredits($row->id)) . '</td>';
                echo '<td>' . ($row->isMember ? 'Yes' : 'No') . '</td>';
                echo '<td><input type="text" name="students[' . $row->id . '][paidcash]" size="5"></td>';
                echo '<td><input type="text" name="students[' . $row->id . '][paidcredits]" size="5"></td>';
                /*if ($row->isGroup2) {*/
                echo '</tr>';
            }
        }
        echo '</table>';
        echo '<br><br><input class="bigbutton" type="submit" name="startclass" value="Start Class">';
        echo '</form>';
        $option = "com_cbodb";
        $link = JRoute::_('index.php?option=' . $option . '&task=shop&key=3b767559374f5132236f6e68256b2529' . '#top');
        echo '<br /><h2>or&nbsp;<a href=' . $link . '>Return to Clock-In Page</a></h2>';
    }