Esempio n. 1
0
function render_family_members($clientid)
{
    $html = '';
    $rows = '';
    $client_family_members = new Template();
    $client_family_members->load('client_family_members');
    $client_family_members_row = new Template();
    $client_family_members_row->load('client_family_members_row');
    $members = get_all_family_members($clientid);
    foreach ($members as $member) {
        $client_family_members_row_render['id'] = $member['clientid'];
        $client_family_members_row_render['name'] = $member['first_name'];
        $client_family_members_row_render['dob'] = $member['dob'];
        $client_family_members_row_render['gender'] = $member['gender'] == '1' ? 'Male' : 'Female';
        $client_family_members_row_render['family'] = $clientid;
        $client_family_members_row->set_vars($client_family_members_row_render);
        $client_family_members_row->parse();
        $rows .= $client_family_members_row->final;
    }
    $client_family_members_render['rows'] = $rows;
    $client_family_members->set_vars($client_family_members_render);
    $client_family_members->parse();
    $html = $client_family_members->final;
    echo $html;
    exit;
}
Esempio n. 2
0
/** import family information from csv version of the excel master database
 */
function import_family($last_name, $first_name, $dob, $address, $telephone, $family_size, $seniors, $adults, $children, $delivery, $dietary, $second_fourth_both, $wages, $unemployment, $wic, $welfare, $head_start, $afdc, $veterans_aid, $social_security, $ssi, $other, $fuel, $food_stamps, $cooking, $start, $comments, $name2, $dob2, $name3, $dob3, $name4, $dob4, $name5, $dob5, $name6, $dob6, $name7, $dob7, $name8, $dob8, $name9, $dob9, $name10, $dob10, $sep2009, $oct2009, $nov2009, $dec2009, $jan2010, $feb2010, $mar2010, $apr2010)
{
    $root = create_client(null, $first_name, $last_name, '0', convert_date($dob));
    $second = false;
    $fourth = false;
    if ($second_fourth_both == '2nd') {
        $second = true;
    } else {
        if ($second_fourth_both == '4th') {
            $fourth = true;
        } else {
            if ($second_fourth_both == 'Both') {
                $second = $fourth = true;
            }
        }
    }
    // Create Family
    $fid = create_family($root, $family_size, $address, $telephone, $fuel == 'Y', false, $delivery == 'Y', $dietary == 'Y', $second, $fourth, $cooking == 'Y', convert_date($start), $comments);
    // Import Family Members
    for ($i = 2; $i < 11; $i++) {
        $name_var = 'name' . $i;
        $dob_var = 'dob' . $i;
        $name = ${$name_var};
        $dob = ${$dob_var};
        if ($name == '') {
            break;
        }
        create_client($fid, $name, '', true, convert_date($dob));
    }
    // Add Family Financial Aids
    // $wages, $unemployment, $wic, $welfare, $head_start, $afdc, $veterans_aid, $social_security, $ssi, $other, $fuel, $food_stamps
    $aids = get_all_aids();
    $aidid = '-1';
    $amount = '0';
    foreach ($aids as $aid) {
        switch ($aid['name']) {
            case 'Wages':
                $amount = $wages;
                break;
            case 'Unemployment':
                $amount = $unemployment;
                break;
            case 'WIC':
                $amount = $wic;
                break;
            case 'Welfare':
                $amount = $welfare;
                break;
            case 'Head Start':
                $amount = $head_start;
                break;
            case 'AFDC':
                $amount = $afdc;
                break;
            case 'Veterans Aid':
                $amount = $veterans_aid;
                break;
            case 'Social Security':
                $amount = $social_security;
                break;
            case 'SSI':
                $amount = $ssi;
                break;
            case 'Other Amount':
                $amount = $other;
                break;
            case 'Fuel Assistance':
                $amount = $fuel;
                break;
            case 'Food Stamps':
                $amount = $food_stamps;
                break;
            default:
                $amount = '0';
                break;
        }
        if ($amount == 'Y') {
            $amount = "0";
        }
        if (is_numeric(trim($amount, "\$"))) {
            set_financial_aid($fid, $aid['aidid'], trim($amount, "\$"));
        }
    }
    $members = get_all_family_members($fid);
    $import_size = count($members) + 1;
    if ($import_size != $family_size) {
        echo "Missed family members for family " . $fid . " and name: " . $last_name . " imported " . $import_size . " and there were " . $family_size . "<br/>";
    }
}
Esempio n. 3
0
function render_usda_sheet($mode)
{
    global $reporting_framework_render;
    global $parameters;
    foreach ($parameters as $parameter) {
        global ${$parameter};
    }
    $content = "";
    // Get transactions of last month
    $start_date = date('Y-m-d', mktime(0, 0, 0, date('m') - 1, date('d'), date('Y')));
    $end_date = date('Y-m-d', mktime(0, 0, 0, date('m'), date('d'), date('Y')));
    $aids = get_all_aids();
    $num_aids = 0;
    $aid_columns = "";
    foreach ($aids as $aid) {
        if ($aid['usda_qualifier'] == '1') {
            $aid_columns .= "<th style=\"vertical-align: bottom;\">" . $aid['name'] . "</th>";
            $num_aids++;
        }
    }
    $reporting_list = new Template();
    $reporting_list->load('report_usda_list');
    $reporting_list_render['num_aids'] = $num_aids;
    $reporting_list_render['aid_columns'] = $aid_columns;
    $reporting_list_render['clients'] = '';
    $report_row = new Template();
    $report_row->load('report_usda_row');
    $report_row_render['name'] = '';
    $report_row_render['address'] = '';
    $report_row_render['size'] = '';
    $report_row_render['client_aids'] = '';
    if ($mode == "active") {
        $clients = get_active_families();
    } else {
        $clients = get_all_client_transactions($start_date, $end_date);
    }
    if ($clients != null) {
        foreach ($clients as $client) {
            $fam = get_family_by_id($client['clientid']);
            $report_row_render['id'] = $fam['clientid'];
            $report_row_render['name'] = $fam['last_name'] . ", " . $fam['first_name'];
            $report_row_render['address'] = $client['address'];
            $report_row_render['size'] = count(get_all_family_members($client['clientid'])) + 1;
            $report_row_render['fuel'] = $fam['fuel_assistance'] == '1' ? "Yes" : "No";
            //$report_row_render['sig'] = $fam['usda_assistance'] == '1' ? "Yes" : "No";
            $report_row_render['sig'] = "";
            // Get and Render Client Aids
            $report_row_render['client_aids'] = '';
            $aids = get_family_usda_aids($client['clientid']);
            foreach ($aids as $aid) {
                $report_row_render['client_aids'] .= "<td>" . ($aid['amount'] == NULL ? "No" : "Yes") . "</td>";
            }
            $report_row->set_vars($report_row_render);
            $report_row->parse();
            $content .= $report_row->final;
        }
    }
    $reporting_list_render['clients'] = $content;
    $reporting_list->set_vars($reporting_list_render);
    $reporting_list->parse();
    $reporting_framework_render['content'] = $reporting_list->final;
    render_all();
}