<?php

require 'insuranceLogic.php';
$plans = readCsv($argv[1]);
$familyMembers = readCsv($argv[2]);
writeTitle();
foreach ($plans as &$plan) {
    $plan['Total Premium'] = calculatePremium($plan, $familyMembers);
    $plan['Total Extra'] = calculateExtra($plan, $familyMembers);
    $plan['Total Copay'] = calculateCopay($plan, $familyMembers);
    $plan['Total'] = $plan['Total Premium'] * 12 + $plan['Total Extra'] + $plan['Total Copay'];
}
function cmp($a, $b)
{
    if ($a['Total'] == $b['Total']) {
        return 0;
    }
    return $a['Total'] < $b['Total'] ? -1 : 1;
}
usort($plans, "cmp");
foreach ($plans as $plan) {
    writePlan($plan);
}
Exemplo n.º 2
0
$_SESSION['pass'] = $pass;
if (strlen($user) == 0 || strlen($pass) == 0) {
    header("location: http://" . $previous);
    die;
} else {
    $host = 'localhost';
    $username = '';
    $passwd = '';
    $database = '';
    $connect = mysql_connect($host, $username, $passwd);
    $table = 'projSecure';
    mysql_select_db($database);
    $query = mysql_query("select * from {$table} where USER = '******'");
    $row = mysql_fetch_row($query);
    errorMessage($error);
    calculateExtra($user);
}
function divSelect($divSelect)
{
    echo $divSelect;
    $_SESSION['divSelect'] = '';
}
function createTable($user)
{
    $query = mysql_query("select b_type, b_percent, b_amount from UserData where user = '******'");
    if (mysql_num_rows($query) != 0) {
        echo '<table class="budgetTable" border=1>';
        echo '<th> Envelope Name <th> Envelope Percentage <th> Envelope Amount';
        while ($row = mysql_fetch_row($query)) {
            echo '<tr>';
            foreach ($row as $field) {