function _makeCurrency($value, $column)
{
    global $totals;
    $totals[$column] += $value;
    if ($value) {
        return Currency($value);
    }
}
Exemple #2
0
function makeAmountInput($value = '')
{
    return "<INPUT type=text name=amount maxlength=10 size=6 " . ($value ? "value=" . Currency($value) : '') . '>';
}
Exemple #3
0
function printLetter($student, $title)
{
    global $LETTER;
    echo '<B>' . $title . '</B><BR>';
    $letter = $_REQUEST[letter];
    if ($LETTER[student]) {
        $letter = str_replace('__STUDENT__', $student[FIRST_NAME] . ' ' . $student[LAST_NAME], $letter);
    }
    if ($LETTER[student_id]) {
        $letter = str_replace('__STUDENT_ID__', $student[STUDENT_ID], $letter);
    }
    if ($LETTER[parents]) {
        $letter = str_replace('__PARENTS__', GetRelNames($student[STUDENT_ID]), $letter);
    }
    if ($LETTER[balance]) {
        $letter = str_replace('__BALANCE__', Currency($student[BALANCE]), $letter);
    }
    echo $letter;
    echo '<!-- NEW PAGE -->';
}
function _makePaymentsAmount($value, $column)
{
    global $payments_total;
    $payments_total += $value;
    return Currency($value);
}
Exemple #5
0
function makeRPriceInput($value = '', $category = '')
{
    global $THIS_RET;
    if ($value != '') {
        $value = Currency($value);
        return "<DIV id='rp{$THIS_RET['ID']}'><div onclick='javascript:addHTML(\"<INPUT type=text name=rprice[{$THIS_RET['ID']}] value={$value} size=5>\",\"rp{$THIS_RET['ID']}\",true)'>{$value}</div></DIV>";
    } elseif ($THIS_RET[TITLE]) {
        return "<INPUT TYPE=TEXT NAME=rprice[{$THIS_RET['ID']}] size=5>";
    } else {
        return "<INPUT TYPE=TEXT NAME=new_rprice[{$category}] size=5>";
    }
    //return "<INPUT TYPE=TEXT NAME=rprice[$THIS_RET[ID]] VALUE=$value size=5>";
}
function sumCurrency($amount)
{
    global $sumCurrency;
    $sumCurrency += $amount;
    return Currency($amount);
}
function reminder($staff, $school, $target, $last_deposit, $note)
{
    $payment = $target - $staff['BALANCE'];
    if ($payment < 0) {
        return;
    }
    $payment = number_format($payment, 2);
    echo '<TABLE class="width-100p">';
    echo '<TR><TD colspan="3" class="center"><span class="sizep1"><I><B>' . _('Payment Reminder') . '</B></I></span></TD></TR>';
    echo '<TR><TD colspan="3" class="center"><B>' . $school . '</B></TD></TR>';
    echo '<TR><TD style="width:33%;">';
    echo $staff['FIRST_NAME'] . ' ' . $staff['MIDDLE_NAME'] . ' ' . $staff['LAST_NAME'] . '<BR />';
    echo '' . $staff['STAFF_ID'] . '';
    echo '</TD><TD style="width:33%;">';
    echo '&nbsp;<BR />';
    echo '&nbsp;';
    echo '</TD><TD style="width:33%;">';
    echo '&nbsp;<BR />';
    echo '&nbsp;';
    echo '</TD></TR>';
    echo '<TR><TD style="width:33%;">';
    echo ProperDate(DBDate()) . '<BR />';
    echo '' . _('Today\'s Date') . '';
    echo '</TD><TD style="width:34%;">';
    echo ($last_deposit ? $last_deposit['DATE'] : _('None')) . '<BR />';
    echo '' . _('Date of Last Deposit') . '';
    echo '</TD><TD style="width:33%;">';
    echo ($last_deposit ? $last_deposit['AMOUNT'] : _('None')) . '<BR />';
    echo '' . _('Amount of Last Deposit') . '';
    echo '</TD></TR>';
    echo '<TR><TD style="width:33%;">';
    echo ($staff['BALANCE'] < 0 ? '<B>' . Currency($staff['BALANCE']) . '</B>' : Currency($staff['BALANCE'])) . '<BR />';
    echo '' . _('Balance') . '';
    echo '</TD><TD style="width:33%;">';
    echo '<B>' . Currency($payment) . '</B><BR />';
    echo '<B>' . _('Mimimum Payment') . '</B>';
    echo '</TD><TD style="width:33%;">';
    echo ucfirst($staff['PROFILE']) . '<BR />';
    echo '' . _('Profile') . '';
    echo '</TD></TR>';
    $note = str_replace('%F', $staff['FIRST_NAME'], $note);
    //	$note = str_replace('%P',money_format('%i',$payment),$note);
    $note = str_replace('%P', Currency($payment), $note);
    $note = str_replace('%T', $target, $note);
    echo '<TR><TD colspan="3">';
    echo '<BR />' . $note . '<BR />';
    echo '</TD></TR>';
    echo '<TR><TD colspan="3"><BR /><BR /><HR><BR /><BR /></TD></TR></TABLE>';
}
    } else {
        $columns = array();
    }
    $columns += array('TITLE' => _('Fee'), 'AMOUNT' => _('Amount'), 'ASSIGNED_DATE' => _('Assigned'), 'DUE_DATE' => _('Due'), 'COMMENTS' => _('Comment'));
    if (!$_REQUEST['print_statements']) {
        $link['add']['html'] = array('REMOVE' => button('add'), 'TITLE' => _makeFeesTextInput('', 'TITLE'), 'AMOUNT' => _makeFeesTextInput('', 'AMOUNT'), 'ASSIGNED_DATE' => ProperDate(DBDate()), 'DUE_DATE' => _makeFeesDateInput('', 'DUE_DATE'), 'COMMENTS' => _makeFeesTextInput('', 'COMMENTS'));
    }
    if (!$_REQUEST['print_statements']) {
        echo '<FORM action="Modules.php?modname=' . $_REQUEST['modname'] . '" method="POST">';
        //DrawStudentHeader();
        if (AllowEdit()) {
            DrawHeader('', SubmitButton(_('Save')));
        }
        $options = array();
    } else {
        $options = array('center' => false);
    }
    ListOutput($RET, $columns, 'Fee', 'Fees', $link, array(), $options);
    if (!$_REQUEST['print_statements'] && AllowEdit()) {
        echo '<span class="center">' . SubmitButton(_('Save')) . '</span>';
    }
    echo '<BR />';
    if (!$_REQUEST['print_statements']) {
        $payments_total = DBGet(DBQuery("SELECT SUM(p.AMOUNT) AS TOTAL FROM BILLING_PAYMENTS p WHERE p.STUDENT_ID='" . UserStudentID() . "' AND p.SYEAR='" . UserSyear() . "'"));
        $table = '<TABLE><TR><TD style="text-align:right">' . _('Total from Fees') . ': ' . '</TD><TD style="text-align:right">' . Currency($fees_total) . '</TD></TR>';
        $table .= '<TR><TD style="text-align:right">' . _('Less') . ': ' . _('Total from Payments') . ': ' . '</TD><TD style="text-align:right">' . Currency($payments_total[1]['TOTAL']) . '</TD></TR>';
        $table .= '<TR><TD style="text-align:right">' . _('Balance') . ': <b>' . '</b></TD><TD style="text-align:right"><b>' . Currency($fees_total - $payments_total[1]['TOTAL'], 'CR') . '</b></TD></TR></TABLE>';
        DrawHeader('', '', $table);
        echo '</FORM>';
    }
}
Exemple #9
0
    } else {
        $columns = array();
    }
    $columns += array('TITLE' => _('Fee'), 'AMOUNT' => _('Amount'), 'ASSIGNED_DATE' => _('Assigned'), 'DUE_DATE' => _('Due'), 'COMMENTS' => _('Comment'));
    if (!$_REQUEST['print_statements']) {
        $link['add']['html'] = array('REMOVE' => button('add'), 'TITLE' => _makeFeesTextInput('', 'TITLE'), 'AMOUNT' => _makeFeesTextInput('', 'AMOUNT'), 'ASSIGNED_DATE' => ProperDate(DBDate()), 'DUE_DATE' => _makeFeesDateInput('', 'DUE_DATE'), 'COMMENTS' => _makeFeesTextInput('', 'COMMENTS'));
    }
    if (!$_REQUEST['print_statements']) {
        echo "<FORM action=Modules.php?modname={$_REQUEST['modname']} method=POST>";
        DrawStudentHeader();
        if (AllowEdit()) {
            DrawHeader('', '<INPUT type=submit value=' . _('Save') . '>');
        }
        $options = array();
    } else {
        $options = array('center' => false);
    }
    ListOutput($RET, $columns, _('Fee'), _('Fees'), $link, array(), $options);
    if (!$_REQUEST['print_statements'] && AllowEdit()) {
        echo '<CENTER><INPUT type=submit value=' . _('Save') . '></CENTER>';
    }
    echo '<BR>';
    if (!$_REQUEST['print_statements']) {
        $payments_total = DBGet(DBQuery("SELECT SUM(p.AMOUNT) AS TOTAL FROM BILLING_PAYMENTS p WHERE p.STUDENT_ID='" . UserStudentID() . "' AND p.SYEAR='" . UserSyear() . "'"));
        $table = '<TABLE><TR><TD align=' . ALIGN_RIGHT . '>' . _('Total from Fees:') . ' ' . str_replace(SystemPreferences('CURRENCY'), SystemPreferences('CURRENCY') . '</TD><TD align=' . ALIGN_RIGHT . '>', Currency($fees_total)) . '</TD></TR>';
        $table .= '<TR><TD align=' . ALIGN_RIGHT . '>' . _('Less: Total from Payments:') . ' ' . str_replace(SystemPreferences('CURRENCY'), SystemPreferences('CURRENCY') . '</TD><TD align=' . ALIGN_RIGHT . '>', Currency($payments_total[1]['TOTAL'])) . '</TD></TR>';
        $table .= '<TR><TD align=' . ALIGN_RIGHT . '>' . _('Balance:') . ' <b>' . str_replace(SystemPreferences('CURRENCY'), SystemPreferences('CURRENCY') . '</b></TD><TD align=' . ALIGN_RIGHT . '><b>', Currency($fees_total - $payments_total[1]['TOTAL'], 'CR')) . '</b></TD></TR></TABLE>';
        DrawHeader('', '', $table);
        echo '</FORM>';
    }
}
function reminder($student, $teacher, $xstudents, $target, $last_deposit, $note)
{
    $payment = $target - $student['BALANCE'];
    if ($_REQUEST['year_end'] == 'Y') {
        $payment = floor($payment * 2 + 0.99) / 2;
    }
    if ($payment <= 0) {
        return;
    }
    $payment = number_format($payment, 2);
    echo '<TABLE class="width-100p">';
    echo '<TR><TD colspan="3" class="center"><span class="sizep1"><I><B>* * * ' . ($_REQUEST['year_end'] == 'Y' ? _('Year End') . ' ' : '') . _('Lunch Payment Reminder') . ' * * *</B></I></span></TD></TR>';
    echo '<TR><TD colspan="3" class="center"><B>' . $student['SCHOOL'] . '</B></TD></TR>';
    echo '<TR><TD style="width:33%;">';
    echo ($student['NICKNAME'] ? $student['NICKNAME'] : $student['FIRST_NAME']) . ' ' . $student['LAST_NAME'] . '<BR />';
    echo '' . $student['STUDENT_ID'] . '';
    if (count($xstudents)) {
        echo '<BR />' . Localize('colon', _('Other students on this account'));
        foreach ($xstudents as $xstudent) {
            echo '<BR />&nbsp;&nbsp;' . ($xstudent['NICKNAME'] ? $xstudent['NICKNAME'] : $xstudent['FIRST_NAME']) . ' ' . $xstudent['LAST_NAME'];
        }
        echo '';
    }
    echo '</TD><TD style="width:33%;">';
    echo $student['GRADE'] . '<BR />';
    echo 'Grade';
    echo '</TD><TD style="width:33%;">';
    echo $teacher['FULL_NAME'] . '<BR />';
    echo '' . $teacher['TITLE'] . ' ' . _('Teacher') . '';
    echo '</TD></TR>';
    echo '<TR><TD style="width:33%;">';
    echo ProperDate(DBDate()) . '<BR />';
    echo '' . _('Today\'s Date') . '';
    echo '</TD><TD style="width:34%;">';
    echo ($last_deposit ? $last_deposit['DATE'] : _('None')) . '<BR />';
    echo '' . _('Date of Last Deposit') . '';
    echo '</TD><TD style="width:33%;">';
    echo ($last_deposit ? $last_deposit['AMOUNT'] : _('None')) . '<BR />';
    echo '' . _('Amount of Last Deposit') . '';
    echo '</TD></TR>';
    echo '<TR><TD style="width:33%;">';
    echo ($student['BALANCE'] < 0 ? '<B>' . Currency($student['BALANCE']) . '</B>' : Currency($student['BALANCE'])) . '<BR />';
    echo '' . _('Balance') . '';
    echo '</TD><TD style="width:34%;">';
    echo '<B>' . Currency($payment) . '</B><BR />';
    echo '<B>' . ($_REQUEST['year_end'] == 'Y' ? _('Requested Payment') : _('Mimimum Payment')) . ' </B>';
    echo '</TD><TD style="width:33%;">';
    echo $student['ACCOUNT_ID'] . '<BR />';
    echo '' . _('Account ID') . '';
    echo '</TD></TR>';
    $note = str_replace('%N', $student['NICKNAME'] ? $student['NICKNAME'] : $student['FIRST_NAME'], $note);
    $note = str_replace('%F', $student['FIRST_NAME'], $note);
    $note = str_replace('%g', $student['GENDER'] ? mb_substr($student['GENDER'], 0, 1) == 'F' ? 'she' : 'he' : 'he/she', $note);
    $note = str_replace('%G', $student['GENDER'] ? mb_substr($student['GENDER'], 0, 1) == 'F' ? 'She' : 'He' : 'He/she', $note);
    $note = str_replace('%h', $student['GENDER'] ? mb_substr($student['GENDER'], 0, 1) == 'F' ? 'her' : 'his' : 'his/her', $note);
    $note = str_replace('%H', $student['GENDER'] ? mb_substr($student['GENDER'], 0, 1) == 'F' ? 'Her' : 'His' : 'His/her', $note);
    //	$note = str_replace('%P',money_format('%i',$payment),$note);
    $note = str_replace('%P', Currency($payment), $note);
    $note = str_replace('%T', $target, $note);
    echo '<TR><TD colspan="3">';
    echo '<BR />' . $note . '<BR />';
    echo '</TD></TR>';
    echo '<TR><TD colspan="3"><BR /><BR /><HR><BR /><BR /></TD></TR></TABLE>';
}
function _makeCurrency($value, $column)
{
    return Currency($value * -1);
}
Exemple #12
0
* @copyright Copyright (C) 2006 Andrew Schmadeke. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.txt
* Focus/SIS is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See COPYRIGHT.txt for copyright notices and details.
*/
DrawHeader(ProgramTitle());
if ($_REQUEST['day_start'] && $_REQUEST['month_start'] && $_REQUEST['year_start']) {
    $start_date = $_REQUEST['day_start'] . '-' . $_REQUEST['month_start'] . '-' . $_REQUEST['year_start'];
} else {
    $start_date = '01-' . strtoupper(date('M-y'));
}
if ($_REQUEST['day_end'] && $_REQUEST['month_end'] && $_REQUEST['year_end']) {
    $end_date = $_REQUEST['day_end'] . '-' . $_REQUEST['month_end'] . '-' . $_REQUEST['year_end'];
} else {
    $end_date = DBDate();
}
echo "<FORM action=Modules.php?modname={$_REQUEST['modname']} method=POST>";
DrawHeader(' &nbsp; &nbsp; <B>' . _('Report Timeframe') . ': </B>' . PrepareDate($start_date, '_start') . ' - ' . PrepareDate($end_date, '_end'), '<INPUT type=submit value=' . _('Go') . '>');
echo '</FORM>';
$billing_payments = DBGet(DBQuery("SELECT sum(AMOUNT) AS AMOUNT FROM BILLING_PAYMENTS WHERE SYEAR='" . UserSyear() . "' AND SCHOOL_ID='" . UserSchool() . "' AND PAYMENT_DATE BETWEEN '{$start_date}' AND '{$end_date}'"));
$billing_fees = DBGet(DBQuery("SELECT sum(f.AMOUNT) AS AMOUNT FROM BILLING_FEES f WHERE AND f.SCHOOL_ID='" . UserSchool() . "' AND f.ASSIGNED_DATE BETWEEN '{$start_date}' AND '{$end_date}'"));
PopTable('header', _('Totals'));
echo '<TABLE border=0 cellpadding=0 cellspacing=0>';
echo '<TR><TD align=' . ALIGN_RIGHT . '>' . _('Payments:') . ' ' . str_replace(SystemPreferences('CURRENCY'), SystemPreferences('CURRENCY') . '</TD><TD align=' . ALIGN_RIGHT . '>', Currency($billing_payments[1]['AMOUNT'])) . '</TD></TR>';
echo '<TR><TD align=' . ALIGN_RIGHT . '>' . _('Less: Fees:') . ' ' . str_replace(SystemPreferences('CURRENCY'), SystemPreferences('CURRENCY') . '</TD><TD align=' . ALIGN_RIGHT . '>', Currency($billing_fees[1]['AMOUNT'])) . '</TD></TR>';
echo '<TR><TD align=' . ALIGN_RIGHT . ' style="border:1;border-style: solid none none none;"><B>' . _('Total:') . ' ' . str_replace(SystemPreferences('CURRENCY'), SystemPreferences('CURRENCY') . '</B></TD><TD align=' . ALIGN_RIGHT . ' style="border:1;border-style: solid none none none"><B>', Currency($billing_payments[1]['AMOUNT'] - $billing_fees[1]['AMOUNT'])) . '</B></TD></TR>';
echo '</TABLE>';
PopTable('footer');
Exemple #13
0
        $singular = 'Lunch Payment';
        $plural = 'Lunch Payments';
    } else {
        $singular = 'Payment';
        $plural = 'Payments';
    }
    $options = array('print' => false);
    if (isset($_REQUEST['PDF'])) {
        $options['center'] = false;
    }
    ListOutput($payments_RET, $columns, $singular, $plural, $link, array(), $options);
    if (!isset($_REQUEST['PDF'])) {
        echo '<center><INPUT type=submit value="Add Payment"></center>';
        echo '</FORM>';
    }
    echo '</TD>';
    echo '</TR>';
    echo '</TABLE>';
    echo '<BR><B>Balance:</B> ';
    if ($balance > 0) {
        echo '<font color=red>';
    }
    echo Currency(0 - $balance);
    if ($balance > 0) {
        echo '</font>';
    }
    $balance = 0;
    if (!isset($_REQUEST['PDF'])) {
        echo '</CENTER>';
    }
}
Exemple #14
0
    $RET = DBGet($QI);
    echo '<TD>' . Currency($RET[1][TOTAL]) . '</TD>';
    echo '</TR>';
    // LUNCH CREDITS
    echo '<TR><TH align=left>Lunch Credits</TH>';
    $sql = "SELECT sum(AMOUNT) as TOTAL FROM STU_BILLING_ACT sba ";
    if ($_REQUEST[sch]) {
        $sql .= ",STU_SCHOOL_MEETS ssm WHERE ssm.SYEAR=sba.SYEAR AND ssm.STUDENT_ID=sba.STUDENT_ID AND ssm.SCHOOL='{$_REQUEST['sch']}' AND ";
    } else {
        $sql .= "WHERE ";
    }
    $sql .= "sba.PAYMENT_DATE BETWEEN '{$begin_date}' AND '{$end_date}' AND sba.LUNCH_PAYMENT='Y' ";
    $QI = DBQuery($sql);
    $RET = DBGet($QI);
    echo '<TD>' . Currency($RET[1][TOTAL]) . '</TD>';
    echo '</TR>';
    // LUNCH DEBITS
    echo '<TR><TH align=left>Lunch Debits</TH>';
    $sql = "SELECT sum(AMOUNT) as TOTAL FROM STU_BILLING_ACT_LUNCH sba ";
    if ($_REQUEST[sch]) {
        $sql .= ",STU_SCHOOL_MEETS ssm WHERE ssm.SYEAR=sba.SYEAR AND ssm.STUDENT_ID=sba.STUDENT_ID AND ssm.SCHOOL='{$_REQUEST['sch']}' AND ";
    } else {
        $sql .= "WHERE ";
    }
    $sql .= "sba.PAYMENT_DATE BETWEEN '{$begin_date}' AND '{$end_date}' ";
    $QI = DBQuery($sql);
    $RET = DBGet($QI);
    echo '<TD>' . Currency($RET[1][TOTAL]) . '</TD>';
    echo '</TR>';
    echo '</TABLE>';
}
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See COPYRIGHT.txt for copyright notices and details.
*/
DrawHeader(ProgramTitle());
if ($_REQUEST['day_start'] && $_REQUEST['month_start'] && $_REQUEST['year_start']) {
    while (!VerifyDate($start_date = $_REQUEST['day_start'] . '-' . $_REQUEST['month_start'] . '-' . $_REQUEST['year_start'])) {
        $_REQUEST['day_start']--;
    }
} else {
    $start_date = '01-' . mb_strtoupper(date('M-y'));
}
if ($_REQUEST['day_end'] && $_REQUEST['month_end'] && $_REQUEST['year_end']) {
    while (!VerifyDate($end_date = $_REQUEST['day_end'] . '-' . $_REQUEST['month_end'] . '-' . $_REQUEST['year_end'])) {
        $_REQUEST['day_end']--;
    }
} else {
    $end_date = DBDate();
}
echo '<FORM action="Modules.php?modname=' . $_REQUEST['modname'] . '" method="POST">';
DrawHeader(' &nbsp; &nbsp; <B>' . _('Report Timeframe') . ': </B>' . PrepareDate($start_date, '_start') . ' - ' . PrepareDate($end_date, '_end'), SubmitButton(_('Go')));
echo '</FORM>';
$billing_payments = DBGet(DBQuery("SELECT sum(AMOUNT) AS AMOUNT FROM BILLING_PAYMENTS WHERE SYEAR='" . UserSyear() . "' AND SCHOOL_ID='" . UserSchool() . "' AND PAYMENT_DATE BETWEEN '{$start_date}' AND '{$end_date}'"));
$billing_fees = DBGet(DBQuery("SELECT sum(f.AMOUNT) AS AMOUNT FROM BILLING_FEES f WHERE AND f.SCHOOL_ID='" . UserSchool() . "' AND f.ASSIGNED_DATE BETWEEN '{$start_date}' AND '{$end_date}'"));
PopTable('header', _('Totals'));
echo '<TABLE class="cellpadding-0 cellspacing-0">';
echo '<TR><TD style="text-align:right">' . _('Payments') . ': ' . '</TD><TD style="text-align:right">' . Currency($billing_payments[1]['AMOUNT']) . '</TD></TR>';
echo '<TR><TD style="text-align:right">' . _('Less') . ': ' . _('Fees') . ': ' . '</TD><TD style="text-align:right">' . Currency($billing_fees[1]['AMOUNT']) . '</TD></TR>';
echo '<TR><TD style="text-align:right;border:1;border-style: solid none none none;"><B>' . _('Total') . ': ' . '</B></TD><TD style="text-align:right;border:1;border-style: solid none none none"><B>' . Currency($billing_payments[1]['AMOUNT'] - $billing_fees[1]['AMOUNT']) . '</B></TD></TR>';
echo '</TABLE>';
PopTable('footer');