}
$remaining_month = $initial + $spent;
echo "<div class= \"rest\">\n<p><strong>For the rest of the month...</strong><br/>\n";
echo "Remaining amount: " . my_money_format($remaining_month) . "\n<br/>\n";
echo "Per day: " . my_money_format($remaining_month / $remaining_days) . "\n<br/>\n";
echo "Per week: " . my_money_format(7 * $remaining_month / $remaining_days) . "</p>\n";
echo "</div>\n</div>\n";
//establish the prorated amounts:
//proration of varaible expense:
$var_expenses = get_var_expenses();
$output = "";
while ($v_expense = mysql_fetch_array($var_expenses)) {
    $output .= "<div class= \"wrapper\">\n\n    <div class= \"exp_title\">\n\n    <h3>{$v_expense['item']}</h3>\n</div>\n";
    $output .= "<div class= \"summary\">\n";
    $month_total_exp = $v_expense['daily_amt'] * $total_days;
    $spent = sum_variable_exp($v_expense['id'], $first_stamp);
    $output .= "<p><strong>Summary</strong></p>\n";
    $output .= "<p>Beginning amount this month: " . my_money_format($month_total_exp) . "<br/>\n";
    $output .= "Spent: " . my_money_format($spent) . "</p>\n";
    $output .= "</div>";
    $output .= "<div class= \"exp_title\"><h3>Remaining</h3></div>\n";
    if ($today < $mid_stamp) {
        //the mid month pay day has NOT passed
        $output .= "<div class= \"mid\">\n";
        $mid_proration = $month_total_exp * $first_half_days / $total_days;
        $output .= "<p><strong>Till pay day...</strong>\n<br/>\n";
        $output .= "Remaining: " . my_money_format($mid_proration + $spent) . "\n" . "<br/>\n";
        $remaining = ($mid_proration + $spent) / $days_till_mid;
        $output .= "Per day: " . my_money_format($remaining) . "<br/>";
        $output .= "Per week: " . my_money_format($remaining * 7);
        $output .= "</p></div>";
示例#2
0
    //estimated expense
    $monthly_estimate -= $estimate;
}
?>
</td>
    <!-- PAID -->
    <td><?php 
if ($expense['type'] != 2 && paid_fixed_exp($expense[id], $first_stamp) == $expense[id]) {
    echo "yes";
    $paid = "TRUE";
} elseif ($expense[type] != 2) {
    $paid = FALSE;
    echo "no";
} else {
    //this IS a variable expense and we'll calculate the amount spent...
    $spent = sum_variable_exp($expense[id], $first_stamp);
    echo my_money_format($spent);
}
?>
</td>
    <!-- ALLOCATED -->
    <td><?php 
//ALLOCATED
if ($paid && $expense['type'] != 2) {
    //NOT variable AND PAID. just set $alloated to zero
    $allocated = 0;
} else {
    //NOT paid
    if ($expense['type'] != 2) {
        //not a variable expense...outputs what is allocated/month
        $allocated = allocated($expense['num_months'], $expense['total_exp'], $expense['due_date'], $thismonth);