echo "Invoice Ref: <a href=\"index2.php?page=timesheet_invoice_view&amp;invoice_id={$invoice_id}\">{$invoice_ref}</a>, issued: " . TimeFormat($invoice_date);
         if ($invoice_paid > 0) {
             echo ", paid: " . TimeFormat($invoice_paid);
         }
         echo "</td></tr>";
     }
     $counter++;
     $prog_begin = $prog_begin + $ts_fee_time_end;
     unset($highlight);
 }
 unset($highlight);
 if ($user_usertype_current > 3) {
     echo "<tr><td colspan=\"5\"><strong>Total Fee for All Stages</strong></td><td style=\"text-align: right;\" colspan=\"3\"><strong>" . MoneyFormat($fee_total) . "</strong></td></tr>";
     $profit = ($fee_total / $target_cost_total - 1) * 100;
     $target_fee_percentage = number_format($profit, 2);
     echo "<tr><td colspan=\"5\"><strong>Target Cost for All Stages</strong></td><td style=\"text-align: right;\" colspan=\"3\"><strong>" . MoneyFormat($target_cost_total) . " (" . $target_fee_percentage . "% Profit Overall)</strong></td></tr>";
 }
 echo "<tr><td colspan=\"8\"><input type=\"submit\" value=\"Update Current Fee Stage\" /></td></tr>";
 echo "</form>";
 echo "</table>";
 $sql = "SELECT ts_fee_id, ts_fee_text FROM intranet_timesheet_fees WHERE ts_fee_project = {$proj_id} ORDER BY ts_fee_text, ts_fee_time_begin";
 $result = mysql_query($sql, $conn) or die(mysql_error());
 $sql_count = "SELECT ts_project FROM intranet_timesheet WHERE ts_project = {$proj_id} AND ts_stage_fee = 0";
 $result_count = mysql_query($sql_count, $conn) or die(mysql_error());
 $null_rows = mysql_num_rows($result_count);
 if ($user_usertype_current > 3 && mysql_num_rows($result) > 0 && $null_rows > 0) {
     echo "<fieldset><legend>Reconcile Unassigned Hours</legend>";
     echo "<p>Move all unassigned hours ({$null_rows} entries) to this fee stage:</p>";
     echo "<form action=\"index2.php?page=project_fees&amp;proj_id={$proj_id}\" method=\"post\">";
     echo "<input type=\"hidden\" name=\"action\" value=\"fee_move_unassigned\" />";
     echo "<select name=\"ts_fee_id\">";
<?php

if ($user_usertype_current <= 3) {
    echo "<h1 class=\"heading_alert\">Permission Denied</h1><p>You do not have permission to view this page.</p>";
} else {
    $year_now = $_GET[year];
    $year_before = $_GET[year] - 1;
    $expense_category = urldecode($_GET[expense_category]);
    $date_begin = mktime(0, 0, 0, 5, 1, $year_before);
    $date_end = mktime(23, 59, 59, 4, 30, $year_now);
    echo "<h1>Expense Analysis for {$year_before} - {$year_now}: {$expense_category}</h1>";
    echo "<p>List expenses dated between " . date("j F Y", $date_begin) . " and " . date("j F Y", $date_end) . "<br />This excludes personal and invoices items, but includes VAT.</p>";
    $sql = "SELECT ts_expense_desc, ts_expense_vat, ts_expense_id, ts_expense_date, user_name_first, user_name_second FROM intranet_timesheet_expense LEFT JOIN  intranet_user_details ON ts_expense_user = user_id WHERE ts_expense_date BETWEEN {$date_begin} and {$date_end} AND ts_expense_invoiced = 0 AND ts_expense_p11d != 1 AND ts_expense_category = '{$_GET['expense_cat_id']}' ORDER BY ts_expense_date";
    $result = mysql_query($sql, $conn) or die(mysql_error());
    echo "<table>";
    while ($array = mysql_fetch_array($result)) {
        $ts_expense_id = $array['ts_expense_id'];
        $ts_expense_vat = $array['ts_expense_vat'];
        $ts_expense_desc = $array['ts_expense_desc'];
        $ts_expense_date = $array['ts_expense_date'];
        $user_name_first = $array['user_name_first'];
        $user_name_second = $array['user_name_second'];
        $grand_total = $grand_total + $ts_expense_vat;
        echo "<tr><td style=\"width: 40%;\"><a href=\"index2.php?page=timesheet_expense_view&amp;ts_expense_id={$ts_expense_id}\">{$ts_expense_desc}</a></td><td>{$user_name_first} {$user_name_second}</td><td><a href=\"index2.php?page=datebook_view_day&amp;time={$ts_expense_date}\">" . TimeFormat($ts_expense_date) . "</a></td><td style=\"text-align: right;\">" . MoneyFormat($ts_expense_vat) . "</td></tr>";
        $category_current = $expense_cat_name;
        $category_total = 0;
    }
    echo "<tr><td colspan=\"3\"><strong>Total</strong></td><td style=\"text-align: right;\"><strong>" . MoneyFormat($grand_total) . "</strong></td></tr>";
}
echo "</table>";
            $expense_total = $expense_total + $ts_expense_vat;
            if ($user_usertype_current > 3 and $ts_expense_verified == 0) {
                print "<td style=\"width: 5%\"><input type=\"checkbox\" value=\"{$ts_expense_id}\" name=\"ts_expense_verified[]\" /></td>";
            } elseif ($ts_expense_verified == 0) {
                print "<td style=\"width: 5%\">No</td>";
            } else {
                print "<td style=\"width: 5%\">" . TimeFormatBrief($ts_expense_verified) . "</td>";
            }
            print "<td style=\"width: 5%\">";
            if ($user_usertype_current > 3 and $ts_expense_invoiced > 1) {
                $sql_invoice = "SELECT invoice_id, invoice_ref FROM intranet_timesheet_invoice WHERE invoice_id = {$ts_expense_invoiced} LIMIT 1";
                $result_invoice = mysql_query($sql_invoice, $conn) or die(mysql_error());
                $array_invoice = mysql_fetch_array($result_invoice);
                $invoice_id = $array_invoice['invoice_id'];
                $invoice_ref = $array_invoice['invoice_ref'];
                print "<a href=\"index2.php?page=timesheet_invoice_view&amp;invoice_id={$invoice_id}\">{$invoice_ref}</a>";
            } elseif ($ts_expense_p11d == 1) {
                echo "Personal";
            } else {
                print "No";
            }
            print "<input type=\"hidden\" name=\"ts_expense_id[]\" value=\"{$ts_expense_id}\" /><input type=\"hidden\" name=\"ts_expense_desc[]\" value=\"{$ts_expense_desc}\" /></td></tr>";
        }
        print "<tr><td colspan=\"5\"><strong>TOTAL</strong></td><td colspan=\"3\" style=\"text-align:right;\"><strong>" . MoneyFormat($expense_total) . "</strong></td></tr>";
        $total_non_p11d = $expense_total - $p11d_total;
        echo "<tr><td colspan=\"8\"><i>Of which, " . MoneyFormat($p11d_total) . " are personal expenses, the remaining " . MoneyFormat($total_non_p11d) . " are office expenses.</td></tr>";
    } else {
        print "<p>There are no expenses to verify.</p>";
    }
    print "</table>";
}
Exemple #4
0
    function MyMenu()
    {
        if ($this->name && $this->islogin) {
            // ログインしてる人用
            print '<div id="menu">' . "\n";
            //print('<span class="divide"></span>');//区切り
            print '<a href="' . INDEX . '">首页</a><span class="divide"></span>';
            print '<a href="?hunt">狩猎</a><span class="divide"></span>';
            print '<a href="?item">道具</a><span class="divide"></span>';
            print '<a href="?town">城镇</a><span class="divide"></span>';
            print '<a href="?setting">设置</a><span class="divide"></span>';
            print '<a href="?log">记录</a><span class="divide"></span>';
            if (BBS_OUT) {
                print '<a href="' . BBS_OUT . '" target="_balnk">BBS</a><span class="divide"></span>' . "\n";
            }
            print '</div><div id="menu2">' . "\n";
            ?>
	<div style="width:100%">
	<div style="width:30%;float:left"><?php 
            print $this->name;
            ?>
</div>
	<div style="width:60%;float:right">
	<div style="width:40%;float:left"><span class="bold">资金</span> : <?php 
            print MoneyFormat($this->money);
            ?>
</div>
	<div style="width:40%;float:right"><span class="bold">时间</span> : <?php 
            print floor($this->time);
            ?>
/<?php 
            print MAX_TIME;
            ?>
</div>
	</div>
	<div class="c-both"></div>
	</div>
<?php 
            print '</div>';
        } else {
            if (!$this->name && $this->islogin) {
                // 初回ログインの人
                print '<div id="menu">';
                print "First login. Thankyou for the entry.";
                print '</div><div id="menu2">';
                print "fill the blanks. 来吧,请填写。";
                print '</div>';
            } else {
                //// ログアウト状態の人、来客用の表示
                print '<div id="menu">';
                print '<a href="' . INDEX . '">首页</a><span class="divide"></span>' . "\n";
                print '<a href="?newgame">新注册</a><span class="divide"></span>' . "\n";
                print '<a href="?manual">规则和手册</a><span class="divide"></span>' . "\n";
                print '<a href="?gamedata=job">游戏数据</a><span class="divide"></span>' . "\n";
                print '<a href="?log">战斗记录</a><span class="divide"></span>' . "\n";
                if (BBS_OUT) {
                    print '<a href="' . BBS_OUT . '" target="_balnk">BBS</a><span class="divide"></span>' . "\n";
                }
                print '</div><div id="menu2">';
                print "欢迎来到 [ " . TITLE . " ]";
                print '</div>';
            }
        }
    }
	function GetMoney($money,$team) {
		if(!$money) return false;
		$money	= ceil($money * MONEY_RATE);
		if($team === $this->team0) {
			print("{$this->team0_name} Get ".MoneyFormat($money).".<br />\n");
			$this->team0_money	+= $money;
		} else if($team === $this->team1) {
			print("{$this->team1_name} Get ".MoneyFormat($money).".<br />\n");
			$this->team1_money	+= $money;
		}
	}
        $sql2 = "SELECT invoice_id, invoice_ref FROM intranet_timesheet_invoice WHERE invoice_id = '{$ts_expense_invoiced}' LIMIT 1";
        $result2 = mysql_query($sql2, $conn) or die(mysql_error());
        $array2 = mysql_fetch_array($result2);
        $invoice_id = $array2['invoice_id'];
        $invoice_ref = $array2['invoice_ref'];
        print "<td>";
        if (mysql_num_rows($result2) > 0) {
            $ts_invoice_show = "<a href=\"index2.php?page=timesheet_invoice_view&amp;invoice_id={$invoice_id}\">{$invoice_ref}</a>";
        } else {
            $ts_invoice_show = "No";
        }
        if ($user_usertype_current > 2) {
            print $ts_invoice_show;
        } else {
            print $ts_invoice_ref;
        }
        print "</td>";
        print "<td style=\"text-align: right\">" . MoneyFormat($ts_expense_vat) . "</td></tr>";
        $ts_expense_value_total = $ts_expense_value_total + $ts_expense_vat;
        if ($ts_expense_invoiced > 1) {
            $ts_expense_value_invoiced = $ts_expense_value_invoiced + $ts_expense_vat;
        }
    }
    print "<tr><td colspan=\"4\"><strong>Invoiced</strong></td><td style=\"text-align: right\"><strong>" . MoneyFormat($ts_expense_value_invoiced) . "</strong></td></tr>";
    $ts_expense_remaining = $ts_expense_value_total - $ts_expense_value_invoiced;
    print "<tr><td colspan=\"4\"><strong>Outstanding</strong></td><td style=\"text-align: right\"><strong>" . MoneyFormat($ts_expense_remaining) . "</strong></td></tr>";
    print "<tr><td colspan=\"4\"><strong>TOTAL</strong></td><td style=\"text-align: right\"><strong>" . MoneyFormat($ts_expense_value_total) . "</strong></td></tr>";
    print "</table>";
} else {
    print "<p>There are no expenses on the system for this project.</p>";
}
<?php

$date_verified = time();
$counter = 0;
$total = 0;
$array_id = $_POST['ts_expense_id'];
echo "<table>";
while ($counter < count($array_id)) {
    $sql = "SELECT * FROM intranet_timesheet_expense WHERE ts_expense_id = " . $array_id[$counter] . " ORDER BY ts_expense_date ";
    // $sql2 = "UPDATE intranet_timesheet_expense SET ts_expense_verified = '$date_verified' WHERE ts_expense_id = ".$array_id[$counter]." LIMIT 1";
    $result = mysql_query($sql, $conn) or die(mysql_error());
    // $result2 = mysql_query($sql2, $conn) or die(mysql_error());
    $array_sql = mysql_fetch_array($result);
    $ts_expense_id = $array_sql['ts_expense_id'];
    $ts_expense_desc = $array_sql['ts_expense_desc'];
    $ts_expense_date = $array_sql['ts_expense_date'];
    $ts_expense_vat = $array_sql['ts_expense_vat'];
    $project_id = $array_sql['proj_id'];
    $project_num = $array_sql['proj_num'];
    $project_name = $array_sql['proj_name'];
    $total = $total + $ts_expense_vat;
    print "<tr><td>{$ts_expense_id}</td><td>" . $ts_expense_desc . "</td><td style=\"text-align: right;\">" . MoneyFormat($ts_expense_vat) . "</td></tr>";
    $counter++;
}
echo "</table>";
        $highlight = NULL;
        $highlight2 = NULL;
    }
    if ($fee_total < 1) {
        $fee_total_print = "Hourly Rate";
    } else {
        $fee_total_print = MoneyFormat($fee_total);
    }
    print "<tr><td {$highlight}>{$ts_fee_text}</td><td style=\"text-align: right;{$highlight2}\">" . $fee_total_print . "</td><td style=\"text-align: right;{$highlight2}\">" . MoneyFormat($stage_total) . "</td><td style=\"text-align: right;{$highlight2}\">" . MoneyFormat($invoice_item_total) . "</td></tr>";
    $project_total = $project_total + $stage_total;
    $stage_total = 0;
    $project_fee_total = $project_fee_total + $fee_total;
    $project_invoiced_total = $project_invoiced_total + $invoice_item_total;
    $invoice_item_total = 0;
    $fee_total = 0;
}
$sql3 = "SELECT * FROM intranet_timesheet where ts_project = '{$proj_id}' AND ts_stage_fee < 1 ";
$result3 = mysql_query($sql3, $conn) or die(mysql_error());
while ($array3 = mysql_fetch_array($result3)) {
    $ts_rate = $array3['ts_rate'];
    $ts_overhead = $array3['ts_overhead'];
    $ts_projectrate = $array3['ts_projectrate'];
    $ts_hours = $array3['ts_hours'];
    $stage_total = $stage_total + $ts_hours * ($ts_rate + $ts_overhead + $ts_projectrate);
}
if ($stage_total > 0) {
    print "<tr><td colspan=\"2\">Not Assigned</td><td style=\"text-align: right;\">" . MoneyFormat($stage_total) . "</td><td></td></tr>";
}
$project_total = $project_total + $stage_total;
print "<tr><td><strong>TOTAL</strong></td><td style=\"text-align: right;\"><strong>" . MoneyFormat($project_fee_total) . "</strong></td><td style=\"text-align: right;\"><strong>" . MoneyFormat($project_total) . "</strong></td><td style=\"text-align: right;\"><strong>" . MoneyFormat($project_invoiced_total) . "</strong></td></tr>";
print "</table>";
 $result_cost_stage_uf = mysql_query($sql_cost_stage_uf, $conn) or die(mysql_error());
 $array_cost_stage_uf = mysql_fetch_array($result_cost_stage_uf);
 $cost_stage_uf = $array_cost_stage_uf['SUM(ts_rate * ts_hours)'];
 $cost_total = $cost_stage;
 $bar_units = $bar_width_standard / $bar_scale;
 $this_bar_width = $fee_stage * $bar_units;
 $cost_bar_width = $cost_total * $bar_units;
 if ($this_bar_width == 0) {
     $this_bar_width = $effectively_zero;
 }
 if ($cost_bar_width == 0) {
     $cost_bar_width = $effectively_zero;
 }
 if ($this_bar_width > 0 or $cost_bar_width > 0) {
     $fee_stage_print = str_replace("&pound;", "£", MoneyFormat($fee_stage));
     $cost_total = str_replace("&pound;", "£", MoneyFormat($cost_total)) . " [" . $ts_fee_text . "]";
     // $cost_total = $ts_fee_text . "(";
     $cost_total = RemoveShit($cost_total);
     SetBarLBlue();
     // Now make sure the project header appears if necessary on the next loop
     $current_project = $proj_id;
     if ($proj_riba == $ts_fee_id) {
         $pdf->SetTextColor(0, 0, 0);
     } else {
         $pdf->SetTextColor(150, 150, 150);
     }
     $pdf->Cell(13, 8, $fee_stage_print, 0, R, 0);
     $this_bar_width_1 = $this_bar_width / $ts_fee_target;
     $this_bar_width_2 = $this_bar_width - $this_bar_width_1;
     // Bar showing unfactored amount
     $cost_unfactored = $cost_stage_uf * $bar_units;
        $proj_riba_begin = $array['proj_riba_begin'];
        $proj_riba = $array['proj_riba'];
        $proj_riba_conclude = $array['proj_riba_conclude'];
        $proj_fee_percentage = $array['proj_fee_percentage'];
        $proj_value = $array['proj_value'];
        print "<tr><td><a href=\"index2.php?page=project_view&amp;proj_id={$proj_id}\">{$proj_num}</a></td><td>{$proj_name}";
        if ($user_usertype_current > 3 or $user_id_current == $proj_rep_black) {
            print "&nbsp;<a href=\"index2.php?page=project_edit&amp;proj_id={$proj_id}&amp;status=edit\"><img src=\"images/button_edit.png\" alt=\"Edit\" /></a>";
        }
        if ($proj_fee_percentage < 100) {
            $proj_fee_total = MoneyFormat($proj_fee_percentage / 100 * $proj_value);
        } else {
            $proj_fee_total = MoneyFormat($proj_fee_percentage);
        }
        print "</td><td style=\"text-align: right;\">{$proj_fee_total}</td>";
        print "<td>Duration</td>";
        $nowtime = time();
        $sql2 = "SELECT invoice_item_novat FROM intranet_timesheet_invoice, intranet_timesheet_invoice_item WHERE invoice_project = {$proj_id} AND invoice_item_invoice = invoice_id AND invoice_paid > 0 ";
        $result2 = mysql_query($sql2, $conn) or die(mysql_error());
        while ($array2 = mysql_fetch_array($result2)) {
            $proj_invoiced = $proj_invoiced + $array2['invoice_item_novat'];
        }
        $proj_invoiced = MoneyFormat($proj_invoiced);
        print "<td style=\"text-align: right\">{$proj_invoiced}</td>";
        print "<td></td>";
        print "</tr>\n";
    }
    print "</table>";
} else {
    print "There are no live projects on the system";
}
 $result_cost_stage_uf = mysql_query($sql_cost_stage_uf, $conn) or die(mysql_error());
 $array_cost_stage_uf = mysql_fetch_array($result_cost_stage_uf);
 $cost_stage_uf = $array_cost_stage_uf['SUM(ts_rate * ts_hours * (1 - user_prop_target))'];
 $cost_total = $cost_stage;
 $bar_units = $bar_width_standard / $bar_scale;
 $this_bar_width = $fee_stage * $bar_units;
 $cost_bar_width = $cost_total * $bar_units;
 if ($this_bar_width == 0) {
     $this_bar_width = $effectively_zero;
 }
 if ($cost_bar_width == 0) {
     $cost_bar_width = $effectively_zero;
 }
 if ($this_bar_width > 0 or $cost_bar_width > 0) {
     $fee_stage_print = str_replace("&pound;", "£", MoneyFormat($fee_stage));
     $cost_total = str_replace("&pound;", "£", MoneyFormat($cost_total)) . " [" . $ts_fee_text . "]" . $percent_complete;
     // $cost_total = $ts_fee_text . "(";
     $cost_total = RemoveShit($cost_total);
     SetBarLBlue();
     // Now make sure the project header appears if necessary on the next loop
     $current_project = $proj_id;
     if ($proj_riba == $ts_fee_id) {
         $pdf->SetTextColor(0, 0, 0);
     } else {
         $pdf->SetTextColor(150, 150, 150);
     }
     $pdf->Cell(13, 8, $fee_stage_print, 0, R, 0);
     $this_bar_width_1 = $this_bar_width / $ts_fee_target;
     $this_bar_width_2 = $this_bar_width - $this_bar_width_1;
     // Bar showing unfactored amount
     $cost_unfactored = $cost_stage_uf * $bar_units;
    function MyMenu()
    {
        if ($this->name && $this->islogin) {
            // ログインしてる人用
            print '<div id="menu">' . "\n";
            //print('<span class="divide"></span>');//区切り
            print '<a href="' . INDEX . '">Top</a><span class="divide"></span>';
            print '<a href="?hunt">Hunt</a><span class="divide"></span>';
            print '<a href="?item">Item</a><span class="divide"></span>';
            print '<a href="?town">Town</a><span class="divide"></span>';
            print '<a href="?setting">Setting</a><span class="divide"></span>';
            print '<a href="?log">Log</a><span class="divide"></span>';
            if (BBS_OUT) {
                print '<a href="' . BBS_OUT . '">BBS</a><span class="divide"></span>' . "\n";
            }
            print '</div><div id="menu2">' . "\n";
            ?>
	<div style="width:100%">
	<div style="width:33%;float:left"><?php 
            echo $this->name;
            ?>
</div>
	<div style="width:67%;float:right">
	<div style="width:50%;float:left"><span class="bold">Funds</span> : <?php 
            echo MoneyFormat($this->money);
            ?>
</div>
	<div style="width:50%;float:right"><span class="bold">Time</span> : <?php 
            echo floor($this->time);
            ?>
/<?php 
            echo MAX_TIME;
            ?>
</div>
	</div>
	<div class="c-both"></div>
	</div><?php 
            print '</div>';
        } else {
            if (!$this->name && $this->islogin) {
                // 初回ログインの人
                print '<div id="menu">';
                print "First login. Thankyou for the entry.";
                print '</div><div id="menu2">';
                print "fill the blanks. てきとーに埋めてください。";
                print '</div>';
            } else {
                //// ログアウト状態の人、来客用の表示
                print '<div id="menu">';
                print '<a href="' . INDEX . '">トップ</a><span class="divide"></span>' . "\n";
                print '<a href="?newgame">新規</a><span class="divide"></span>' . "\n";
                print '<a href="?manual">ルールとマニュアル</a><span class="divide"></span>' . "\n";
                print '<a href="?gamedata=job">ゲームデータ</a><span class="divide"></span>' . "\n";
                print '<a href="?log">戦闘ログ</a><span class="divide"></span>' . "\n";
                if (BBS_OUT) {
                    print '<a href="' . BBS_OUT . '">総合BBS</a><span class="divide"></span>' . "\n";
                }
                print '</div><div id="menu2">';
                print "Welcome to [ " . TITLE . " ]";
                print '</div>';
            }
        }
    }
if ($proj_date_complete > 0) {
    echo "<tr><td  >Project Completion Date</td><td  >{$proj_date_complete}</td></tr>";
}
if ($proj_desc != "") {
    echo "<tr><td  >Project Description</td><td  >{$proj_desc}</td></tr>";
}
if ($proj_procure > 0) {
    echo "<tr><td>Procurement Method</td><td>{$proj_procure}</td></tr>";
}
if ($proj_value != 0) {
    $proj_value_show = MoneyFormat($proj_value);
    echo "<tr><td>Contract Value</td><td><a href=\"index2.php?page=timesheet_value_view&amp;proj_id={$proj_id}\">{$proj_value_show}</a></td></tr>";
}
if ($proj_fee_percentage > 0) {
    echo "<tr><td>Fee Percentage</td><td>" . $proj_fee_percentage . "%</td></tr>";
    echo "<tr><td>Total Fee<br /><span class=\"minitext\">(Assuming 100% of fee)</span></td><td>" . MoneyFormat($proj_value * ($proj_fee_percentage / 100)) . "</td></tr>";
}
echo "</table>";
echo "</div><div id=\"item_switch_2\">";
// Project Page Menu
echo "<p class=\"submenu_bar\">";
if ($user_usertype_current > 3 or $user_id_current == $proj_rep_black) {
    echo "<a href=\"index2.php?page=project_edit&amp;status=edit&amp;proj_id={$proj_id}\" class=\"submenu_bar\">Edit</a>";
}
if ($user_usertype_current > 1) {
    echo "<a href=\"index2.php?page=project_blog_edit&amp;status=add&amp;proj_id={$proj_id}\" class=\"submenu_bar\">Add Project Journal Entry</a>";
}
echo "</p>";
// Pull the details from the contact database
echo "<h2>Client</h2>";
echo "<table summary=\"Client Details\">";
        print "<tr><td><u>Fees Sub Total (excl. VAT)</u></td><td style=\"text-align: right;\"><u>" . MoneyFormat($invoice_total_sub) . "</u></td></tr>";
    }
    print "<tr><td colspan=\"2\"><strong>Expenses Details</strong></td></tr>";
    // Output the Invoice Item details
    if (mysql_num_rows($result3) > 0) {
        while ($array3 = mysql_fetch_array($result3)) {
            $ts_expense_id = $array3['ts_expense_id'];
            $ts_expense_value = $array3['ts_expense_value'];
            $ts_expense_vat = $array3['ts_expense_vat'];
            $ts_expense_desc = TextPresent($array3['ts_expense_desc']);
            print "<tr><td><a href=\"index2.php?page=timesheet_expense_view&amp;ts_expense_id={$ts_expense_id}\">" . $ts_expense_desc . "</a>";
            if ($invoice_date > time()) {
                print "&nbsp;<a href=\"index2.php?page=timesheet_expense_edit&amp;status=edit&amp;ts_expense_id={$ts_expense_id}\"><img src=\"images/button_edit.png\" alt=\"Edit Expense\" /></a>";
            }
            print "</td><td style=\"text-align: right;\">" . MoneyFormat($ts_expense_value) . "</td></tr>";
            $invoice_total_all = $invoice_total_all + $ts_expense_vat;
            $invoice_expense_total = $invoice_expense_total + $ts_expense_value;
        }
        print "<tr><td><u>Expenses Sub Total (excl. VAT)</u></td><td style=\"text-align: right;\"><u>" . MoneyFormat($invoice_expense_total) . "</u></td></tr>";
    } else {
        print "<tr><td>None</td><td style=\"text-align: right;\">--</td></tr>";
    }
    $vat_total = $invoice_total_all - ($invoice_expense_total + $invoice_total_sub);
    print "<tr><td><u>VAT</u></td><td style=\"text-align: right; \"><u>" . MoneyFormat($vat_total) . "</u></td></tr>";
    print "<tr><td><strong>INVOICE TOTAL (inc. VAT)</strong></td><td style=\"text-align: right; \"><strong>" . MoneyFormat($invoice_total_all) . "</strong></td></tr>";
    print "<tr><td><strong>Payment Instructions</strong></td><td>{$invoice_text}</td></tr>";
    print "<tr><td><strong>Notes</strong></td><td>{$invoice_notes}</td></tr>";
    print "</table>";
} else {
    print "<p>The invoice you have requested does not exist.</p>";
}
    echo "<p>List expenses verified between {$date_begin} and {$date_end}</p>";
    $sql = "SELECT ts_expense_verified,ts_expense_vat FROM intranet_timesheet_expense  order by ts_expense_verified";
    $result = mysql_query($sql, $conn) or die(mysql_error());
    if (mysql_num_rows($result) > 0) {
        $lasttime = 0;
        $proj_id_current == NULL;
        $expense_total = 0;
        $linecount = 0;
        print "<table summary=\"List all verified expenses by date\">";
        print "<tr><td colspan=\"2\"><strong>Date Verified</strong></td></td></tr>";
        while ($array = mysql_fetch_array($result)) {
            $ts_expense_verified = $array['ts_expense_verified'];
            $ts_expense_vat = $array['ts_expense_vat'];
            if ($ts_expense_verified != $lasttime) {
                if ($linecount > 0) {
                    echo "<td><a href=\"index2.php?page=timesheet_expense_list_verified&amp;time={$lasttime}\">" . MoneyFormat($expense_total) . "</a></td></tr>";
                }
                print "<tr><td><a href=\"index2.php?page=datebook_view_day&amp;time={$ts_expense_verified}\">" . TimeFormat($ts_expense_verified) . "</a>&nbsp;<a href=\"pdf_expense_verified_list.php?time={$ts_expense_verified}\" target=\"_blank\"><img src=\"images/button_pdf.png\" alt=\"PDF Output\" /></a></td>";
                $linecount++;
                $expense_total = 0;
            }
            $expense_total = $ts_expense_vat + $expense_total;
            $lasttime = $ts_expense_verified;
        }
        echo "<td><a href=\"index2.php?page=timesheet_expense_list_verified&amp;time={$ts_expense_verified}\">" . MoneyFormat($expense_total) . "</a></td></tr>";
        echo "</table>";
    } else {
        print "<p>There are no expenses to verify.</p><p>{$sql}</p>";
    }
    print "</table>";
}
}
// Expenses added today
$sql_expense = "SELECT ts_expense_date, ts_expense_desc, ts_expense_id, ts_expense_vat, user_initials FROM intranet_timesheet_expense, intranet_user_details WHERE user_id = ts_expense_user AND ts_expense_date BETWEEN '{$startday}' AND '{$endday}' ORDER BY ts_expense_date";
$result_expense = mysql_query($sql_expense, $conn) or die(mysql_error());
if (mysql_num_rows($result_expense) > 0 and $user_usertype_current > 3) {
    print "<h2>Expenses Added</h2>";
    print "<table summary=\"Expenses added on " . TimeFormat($time) . "\">";
    $list1 = 0;
    $count = 1;
    while ($array_expense = mysql_fetch_array($result_expense)) {
        $ts_expense_date = $array_expense['ts_expense_date'];
        $ts_expense_desc = $array_expense['ts_expense_desc'];
        $ts_expense_id = $array_expense['ts_expense_id'];
        $ts_expense_vat = $array_expense['ts_expense_vat'];
        $user_initials = $array_expense['user_initials'];
        echo "<tr><td><a href=\"index2.php?page=timesheet_expense_view&amp;ts_expense_id={$ts_expense_id}\">" . $ts_expense_desc . " [" . $ts_expense_id . "]</a><td>" . MoneyFormat($ts_expense_vat) . "</td></td><td>{$user_initials}</td></tr>";
    }
    print "</table>";
}
// Expenses verified today
$sql_expense = "SELECT ts_expense_verified FROM intranet_timesheet_expense WHERE ts_expense_verified BETWEEN '{$startday}' AND '{$endday}' ORDER BY ts_expense_verified";
$result_expense = mysql_query($sql_expense, $conn) or die(mysql_error());
if (mysql_num_rows($result_expense) > 0 and $user_usertype_current > 3) {
    print "<h2>Expenses Verified Today</h2>";
    print "<table summary=\"Expenses verified on " . TimeFormat($time) . "\">";
    $list1 = 0;
    $count = 1;
    while ($array_expense = mysql_fetch_array($result_expense)) {
        $ts_expense_verified = $array_expense['ts_expense_verified'];
        if ($ts_expense_verified != $list1) {
            print "<tr><td><a href=\"index2.php?page=timesheet_expense_list_verified&amp;time={$ts_expense_verified}\">Group {$count}: " . TimeFormatDetailed($ts_expense_verified) . "</a>&nbsp;<a href=\"pdf_expense_verified_list.php?time={$ts_expense_verified}\"><img src=\"images/button_pdf.png\" alt=\"PDF Output\" /></a></td></tr>";
Exemple #17
0
データが増えるほど処理も増えます。
</p>
</form>
DATA;
                    } else {
                        if ($_POST["UserDataDetail"]) {
                            include GLOBAL_PHP;
                            include CLASS_USER;
                            $userFileList = glob(USER . "*");
                            foreach ($userFileList as $user) {
                                $user = new user(basename($user, ".dat"));
                                $totalMoney += $user->money;
                            }
                            print "UserAmount :" . count($userFileList) . "<br>\n";
                            print "TotalMoney :" . MoneyFormat($totalMoney) . "<br>\n";
                            print "AveMoney :" . MoneyFormat($totalMoney / count($userFileList)) . "<br>\n";
                        } else {
                            if ($_POST["UserCharDetail"]) {
                                include GLOBAL_PHP;
                                $userFileList = glob(USER . "*");
                                foreach ($userFileList as $user) {
                                    $userDir = glob($user . "/*");
                                    foreach ($userDir as $fileName) {
                                        if (!is_numeric(basename($fileName, ".dat"))) {
                                            continue;
                                        }
                                        $charData = ParseFile($fileName);
                                        $charAmount++;
                                        $totalLevel += $charData["level"];
                                        $totalStr += $charData["str"];
                                        $totalInt += $charData["int"];
Exemple #18
0
 function ItemShowArticle2($bidding = false)
 {
     if (count($this->Article) == 0) {
         print "无拍卖物(No auction)<br />\n";
         return false;
     } else {
         $Now = time();
         if ($this->sort) {
             ${"Style_" . $this->sort} = ' class="a0"';
         }
         $exp = '<tr><td class="td9"><a href="?menu=' . $this->QUERY . '&sort=no"' . $Style_no . '>No</a></td>' . '<td class="td9"><a href="?menu=' . $this->QUERY . '&sort=time"' . $Style_time . '>其余</td>' . '<td class="td9"><a href="?menu=' . $this->QUERY . '&sort=price"' . $Style_price . '>价格</a>' . '<br /><a href="?menu=' . $this->QUERY . '&sort=rprice"' . $Style_rprice . '>(登)</a></td>' . '<td class="td9">Item</td>' . '<td class="td9"><a href="?menu=' . $this->QUERY . '&sort=bid"' . $Style_bid . '>Bids</a></td>' . '<td class="td9">投标人</td><td class="td9">参展人</td></tr>' . "\n";
         print "所列项目总数:" . $this->ItemAmount() . "\n";
         print '<table style="width:725px;text-align:center" cellpadding="0" cellspacing="0" border="0">' . "\n";
         print $exp;
         foreach ($this->Article as $Article) {
             // 競売番号
             print "<tr><td rowspan=\"2\" class=\"td7\">";
             print $Article["No"];
             // 終了時刻
             print "</td><td class=\"td7\">";
             print AuctionLeftTime($Now, $Article["end"]);
             // 現在竞标价格
             print "</td><td class=\"td7\">";
             print MoneyFormat($Article["price"]);
             // アイテム
             print '</td><td class="td7" style="text-align:left">';
             $item = LoadItemData($Article["item"]);
             print ShowItemDetail($item, $Article["amount"], 1);
             // 合計竞标数
             print "</td><td class=\"td7\">";
             print $Article["TotalBid"];
             // 投标人
             print "</td><td class=\"td7\">";
             if (!$Article["bidder"]) {
                 $bidder = "-";
             } else {
                 $bidder = $this->LoadUserName($Article["bidder"]);
             }
             print $bidder;
             // 参展人
             print "</td><td class=\"td8\">";
             $exhibitor = $this->LoadUserName($Article["exhibitor"]);
             print $exhibitor;
             // コメント
             print "</td></tr><tr>";
             print "<td colspan=\"6\" class=\"td8\" style=\"text-align:left\">";
             print '<form action="?menu=auction" method="post">';
             // 竞标フォーム
             if ($bidding) {
                 print '<strong>我要竞标:</strong>';
                 print '<span id="Bid' . $Article["No"] . '">';
                 print ' <input type="text" name="BidPrice" style="width:80px" class="text" value="' . BottomPrice($Article["price"]) . '">';
                 print '<input type="submit" value="出价" class="btn">';
                 print '<input type="hidden" name="ArticleNo" value="' . $Article["No"] . '">';
                 print '</span>';
             }
             print $Article["comment"] ? $Article["comment"] : " ";
             print "</form>";
             print "</td></tr>\n";
             print "</td></tr>\n";
         }
         print $exp;
         print "</table>\n";
         return true;
     }
 }
         $ts_expense_desc = $array['ts_expense_desc'];
         $ts_expense_date = $array['ts_expense_date'];
         $ts_expense_notes = $array['ts_expense_notes'];
         $ts_expense_vat = $array['ts_expense_vat'];
         $ts_expense_verified = $array['ts_expense_verified'];
         if ($ts_expense_verified > 0) {
             $ts_expense_verified = "<a href=\"index2.php?page=datebook_view_day&amp;time={$ts_expense_verified}\">" . TimeFormat($ts_expense_verified) . "</a>";
         } else {
             $ts_expense_verified = "--";
         }
         $user_initials = $array['user_initials'];
         print "<tr><td><a href=\"index2.php?page=datebook_view_day&amp;time={$ts_expense_date}\">" . TimeFormat($ts_expense_date) . "</a></td><td>{$ts_expense_verified}</td><td style=\"width: 50%;\"><a href=\"index2.php?page=timesheet_expense_view&amp;ts_expense_id={$ts_expense_id}\">{$ts_expense_desc}</a>";
         if ($ts_expense_notes != NULL) {
             echo "<br />Notes: {$ts_expense_notes}";
         }
         echo "</td><td>" . MoneyFormat($ts_expense_vat) . " [ID: {$ts_expense_id}]";
         print "<td>{$user_initials}</td></tr>";
     }
     echo "</table>";
 }
 // Tender submissions
 $sql = "SELECT answer_id, answer_response, answer_tender_id, answer_ref, tender_name, tender_date FROM intranet_tender_answers, intranet_tender WHERE " . SearchTerms($keywords_array, "answer_response") . " AND tender_id = answer_tender_id ORDER BY tender_date DESC";
 $result = mysql_query($sql, $conn) or die(mysql_error());
 echo "<table>";
 if (mysql_num_rows($result) == 0) {
     print "<tr><td>No results found for Tenders</td></tr>";
 } else {
     print "<tr><td><strong>Tender Submissions</strong></td></tr>";
     while ($array = mysql_fetch_array($result)) {
         $answer_id = $array['answer_id'];
         $answer_response = strip_tags($array['answer_response']);
            $ts_expense_vat_print = MoneyFormat($ts_expense_vat);
            print "<tr><td {$bg}>{$counter}</td><td {$bg}>" . TimeFormat($ts_expense_date) . "</td><td {$bg}><a href=\"index2.php?page=timesheet_expense_view&amp;ts_expense_id={$ts_expense_id}\">" . $ts_expense_desc . "&nbsp;[{$ts_expense_id}]</a>";
            if ($user_usertype_current > 3 and $ts_expense_invoiced < 1) {
                print "&nbsp;<a href=\"index2.php?page=timesheet_expense_edit&amp;status=edit&amp;ts_expense_id={$ts_expense_id}\"><img src=\"images/button_edit.png\" alt=\"Edit this entry\" /></a>";
            }
            echo "</td><td {$bg}>{$ts_expense_vat_print}</td>";
            $expense_total = $expense_total + $ts_expense_vat;
            if ($ts_expense_p11d == 1) {
                $checked1 = "checked=\"checked\"";
                $checked2 = NULL;
                $expense_total_verified = $expense_total_verified + $ts_expense_vat;
            } else {
                $checked1 = NULL;
                $checked2 = "checked=\"checked\"";
            }
            print "<td {$bg} {$rowspan}><input type=\"radio\" value=\"1\" name=\"ts_expense_p11d[{$counter}]\" {$checked1} /></td><td {$bg}><input type=\"radio\" value=\"0\" name=\"ts_expense_p11d[{$counter}]\" {$checked2} />";
            print "<input type=\"hidden\" name=\"ts_expense_id[{$counter}]\" value=\"{$ts_expense_id}\" /></td></tr>";
            $counter++;
        }
        echo "<tr><td colspan=\"3\"><strong>P11d Total</strong></td><td colspan=\"3\" style=\"text-align:right;\"><strong>" . MoneyFormat($expense_total_verified) . "</strong></td></tr>";
        echo "<tr><td colspan=\"3\"><strong>TOTAL</strong></td><td colspan=\"3\" style=\"text-align:right;\"><strong>" . MoneyFormat($expense_total) . "</strong></td></tr>";
    } else {
        print "<p>There are no P11d items for this user.</p>";
    }
    if ($user_usertype_current > 3) {
        print "<tr><td colspan=\"8\"><input type=\"submit\" value=\"Amend P11d Items\" /></td></tr>";
    }
    print "</table>";
    print "<input type=\"hidden\" name=\"ts_expense_user\" value=\"{$_GET['user_id']}\" /><input type=\"hidden\" name=\"action\" value=\"expense_p11d_verify\" />";
    print "</form>";
}
if ($user_usertype_current < 3) {
    print "<h1 class=\"heading_alert\">Permission Denied</h1><p>You do not have permission to view this page.</p>";
} else {
    print "<h1>Verify Expenses</h1>";
    $date_verified = time();
    $counter = 0;
    $total = 0;
    $array_id = $_POST['ts_expense_verified'];
    print "<p>The following expenses have been verified for " . TimeFormat($date_verified) . "</p>";
    print "<p><a href=\"index2.php?page=timesheet_expense_list\">Click here</a> to return to the expenses list.</p>";
    print "<table summary=\"List of expenses to verify\">";
    while ($counter < count($array_id)) {
        $sql = "SELECT * FROM intranet_timesheet_expense, intranet_projects WHERE ts_expense_id = " . $array_id[$counter] . " AND proj_id = ts_expense_project LIMIT 1";
        $sql2 = "UPDATE intranet_timesheet_expense SET ts_expense_verified = '{$date_verified}' WHERE ts_expense_id = " . $array_id[$counter] . " LIMIT 1";
        $result = mysql_query($sql, $conn) or die(mysql_error());
        $result2 = mysql_query($sql2, $conn) or die(mysql_error());
        $array_sql = mysql_fetch_array($result);
        $ts_expense_id = $array_sql['ts_expense_id'];
        $ts_expense_desc = $array_sql['ts_expense_desc'];
        $ts_expense_date = $array_sql['ts_expense_date'];
        $ts_expense_vat = $array_sql['ts_expense_vat'];
        $project_id = $array_sql['proj_id'];
        $project_num = $array_sql['proj_num'];
        $project_name = $array_sql['proj_name'];
        $total = $total + $ts_expense_vat;
        print "<tr><td>{$project_num}</td><td>" . $ts_expense_desc . "</td><td style=\"text-align: right;\">" . MoneyFormat($ts_expense_vat) . "</td></tr>";
        $counter++;
    }
    print "<tr><td colspan=\"2\"><strong>Total</strong></td><td style=\"text-align: right;\"><strong>" . MoneyFormat($total) . "</strong></td></tr>";
    print "</table>";
}
        $timesheet_datum = $settings_timesheetstart;
    }
} else {
    print "<tr><td colspan=\"4\">There have been no entries added for this week.</td>";
    if ($user_usertype_current > 3) {
        echo "<td style=\"text-align: right; {$background}\"></td>";
    }
    echo "</tr>";
}
print "</table>";
// Now update the user's factored values based on the total number of hours this week
//if ($_POST[ts_hours] != NULL) {
$user_rate_standard = $ts_list_rate + $ts_list_overhead + $ts_list_projectrate;
$user_hourly_factor = round($weekly_hours_required / $ts_list_total * $user_rate_standard, 2);
if ($weekly_hours_required / $ts_list_total > 1) {
    $user_hourly_factor = $user_rate_standard;
}
$ts_weekend = $ts_weekbegin + 604800;
//if ($_POST[ts_project] != NULL) {
if ($ts_list_total >= $weekly_hours_required) {
    $sql_update_factor = "UPDATE intranet_timesheet SET ts_cost_factored = ( ts_hours * {$user_hourly_factor}) WHERE ts_entry > {$ts_weekbegin} AND ts_entry < {$ts_weekend} AND ts_user = {$user_view}";
    $result_update_factor = mysql_query($sql_update_factor, $conn) or die(mysql_error());
} else {
    $sql_update_factor = "UPDATE intranet_timesheet SET ts_cost_factored = (ts_hours * ts_rate) WHERE ts_entry > {$ts_weekbegin} AND ts_entry < {$ts_weekend} AND ts_user = {$user_view}";
    $result_update_factor = mysql_query($sql_update_factor, $conn) or die(mysql_error());
}
echo "<p>" . $sql_update_factor . "</p>";
if ($user_usertype_current > 3) {
    echo "<p>User factored rate for week = &pound;" . $user_hourly_factor . "<br />User standard rate for week: &pound;" . $user_rate_standard . "<br />Weekly cost for user: "******"<br />User hours required: " . $weekly_hours_required . "</p>";
}
//}
 function ItemShowArticle2($bidding = false)
 {
     if (count($this->Article) == 0) {
         print "競売物無し(No auction)<br />\n";
         return false;
     } else {
         $Now = time();
         // ソートされている色を変える(可変変数)
         if ($this->sort) {
             ${"Style_" . $this->sort} = ' class="a0"';
         }
         $exp = '<tr><td class="td9"><a href="?menu=' . $this->QUERY . '&sort=no"' . $Style_no . '>No</a></td>' . '<td class="td9"><a href="?menu=' . $this->QUERY . '&sort=time"' . $Style_time . '>残り</td>' . '<td class="td9"><a href="?menu=' . $this->QUERY . '&sort=price"' . $Style_price . '>価格</a>' . '<br /><a href="?menu=' . $this->QUERY . '&sort=rprice"' . $Style_rprice . '>(昇)</a></td>' . '<td class="td9">Item</td>' . '<td class="td9"><a href="?menu=' . $this->QUERY . '&sort=bid"' . $Style_bid . '>Bids</a></td>' . '<td class="td9">入札者</td><td class="td9">出品者</td></tr>' . "\n";
         print "総出品数:" . $this->ItemAmount() . "\n";
         print '<table style="width:725px;text-align:center" cellpadding="0" cellspacing="0" border="0">' . "\n";
         print $exp;
         foreach ($this->Article as $Article) {
             // 競売番号
             print "<tr><td rowspan=\"2\" class=\"td7\">";
             print $Article["No"];
             // 終了時刻
             print "</td><td class=\"td7\">";
             print AuctionLeftTime($Now, $Article["end"]);
             // 現在入札価格
             print "</td><td class=\"td7\">";
             print MoneyFormat($Article["price"]);
             // アイテム
             print '</td><td class="td7" style="text-align:left">';
             $item = LoadItemData($Article["item"]);
             print ShowItemDetail($item, $Article["amount"], 1);
             // 合計入札数
             print "</td><td class=\"td7\">";
             print $Article["TotalBid"];
             // 入札者
             print "</td><td class=\"td7\">";
             if (!$Article["bidder"]) {
                 $bidder = "-";
             } else {
                 $bidder = $this->LoadUserName($Article["bidder"]);
             }
             print $bidder;
             // 出品者
             print "</td><td class=\"td8\">";
             $exhibitor = $this->LoadUserName($Article["exhibitor"]);
             print $exhibitor;
             // コメント
             print "</td></tr><tr>";
             print "<td colspan=\"6\" class=\"td8\" style=\"text-align:left\">";
             print '<form action="?menu=auction" method="post">';
             // 入札フォーム
             if ($bidding) {
                 print '<a style="margin:0 10px" href="#" onClick="Element.toggle(\'Bid' . $Article["No"] . '\');return false;">入札</a>';
                 print '<span style="display:none" id="Bid' . $Article["No"] . '">';
                 print '&nbsp;<input type="text" name="BidPrice" style="width:80px" class="text" value="' . BottomPrice($Article["price"]) . '">';
                 print '<input type="submit" value="Bid" class="btn">';
                 print '<input type="hidden" name="ArticleNo" value="' . $Article["No"] . '">';
                 print '</span>';
             }
             print $Article["comment"] ? $Article["comment"] : "&nbsp;";
             print "</form>";
             print "</td></tr>\n";
             print "</td></tr>\n";
         }
         print $exp;
         print "</table>\n";
         return true;
     }
 }
                $invoice_total_sub = $invoice_total_sub + $invoice_item_novat;
            }
            print "<tr><td colspan=\"2\" {$highlight}>Fees</td><td {$highlight2}>" . MoneyFormat($invoice_item_total) . "</td></tr>";
        }
        // Output the Expenses details
        if (mysql_num_rows($result3) > 0) {
            $invoice_expense_total = 0;
            while ($array3 = mysql_fetch_array($result3)) {
                $ts_expense_novat = $array3['ts_expense_novat'];
                $ts_expense_vat = $array3['ts_expense_vat'];
                $invoice_expense_total = $invoice_expense_total + $ts_expense_value;
                $invoice_item_vat_total = $invoice_item_vat_total + $ts_expense_vat;
            }
            print "<tr><td colspan=\"2\" {$highlight}>Expenses</td><td {$highlight2}>" . MoneyFormat($invoice_expense_total) . "</td></tr>";
            //$invoice_total_all = $invoice_total_all + $invoice_expense_total;
            $invoice_total_sub = $invoice_total_sub + $invoice_expense_total;
            // if ($invoice_paid > 0) { $invoice_total_paid = $invoice_total_paid + $invoice_expense_total; }
        }
        print "<tr><td colspan=\"2\" {$highlight}>Sub Total</td><td {$highlight2}>" . MoneyFormat($invoice_total_sub) . "</td></tr>";
        print "<tr><td colspan=\"2\" {$highlight}><u>Invoice Total</u> (gross, including expenses)</td><td {$highlight2}><u>" . MoneyFormat($invoice_item_vat_total) . "</u></td></tr>";
        $invoice_total_sub = 0;
        $invoice_item_vat_total = 0;
    }
    print "<tr><td colspan=\"3\"><strong>Issued (net, excluding expenses)</strong><td style=\"text-align: right\"><strong>" . MoneyFormat($invoice_total_all) . "</strong></td></tr>";
    print "<tr><td colspan=\"3\"><strong>Paid (net)</strong><td style=\"text-align: right\"><strong>" . MoneyFormat($invoice_total_paid) . "</strong></td></tr>";
    $invoice_outstanding = $invoice_total_all - $invoice_total_paid;
    print "<tr><td colspan=\"3\"><strong>Outstanding (net)</strong><td style=\"text-align: right\"><strong>" . MoneyFormat($invoice_outstanding) . "</strong></td></tr>";
    print "</table>";
} else {
    print "<p>There are no invoices on the system for this project.</p>";
}
            unset($highlight2);
            $invoice_total_due = $invoice_total_due + $invoice_value;
        }
        print "<tr>";
        print "<td {$highlight}><a href=\"index2.php?page=timesheet_invoice_view&amp;invoice_id={$invoice_id}\">" . $invoice_ref . "</a>";
        if ($user_usertype_current > 3) {
            print "&nbsp;<a href=\"index2.php?page=timesheet_invoice_edit&amp;status=edit&amp;invoice_id={$invoice_id}\"><img src=\"images/button_edit.png\" alt=\"Edit Invoice\" /></a>&nbsp;<a href=\">pdf_invoice.php?invoice_id={$invoice_id}\"><img src=\"images/button_pdf.png\" alt=\"Print Invoice\" /></a>";
        }
        print "<br /><span class=\"minitext\">{$proj_name}</a></td>";
        print "<td {$highlight}><a href=\"index2.php?page=project_view&amp;proj_id={$proj_id}\">{$proj_num}</a></td>";
        print "<td {$highlight}><a href=\"index2.php?page=datebook_view_day&amp;time={$invoice_date}\">" . TimeFormat($invoice_date) . "</a></td>";
        print "<td {$highlight}><a href=\"index2.php?page=datebook_view_day&amp;time={$invoice_due}\">" . TimeFormat($invoice_due) . "</a></td>";
        print "<td {$highlight}>";
        if ($invoice_paid > 0) {
            print "<a href=\"index2.php?page=datebook_view_day&amp;time={$invoice_paid}\">" . TimeFormat($invoice_paid) . "</a>";
        } else {
            print "No";
        }
        print "</td>";
        print "<td style=\"text-align: right{$highlight2}\">" . MoneyFormat($invoice_value) . "</td></tr>";
        $invoice_total_thispage = $invoice_total_thispage + $invoice_value;
        $counter++;
        $invoice_total = $invoice_total + $invoice_value;
    }
    $invoice_total_overdue = $invoice_total - $invoice_total_due;
    print "<tr><td colspan=\"5\"><strong>Total This Page</strong><td style=\"text-align: right\"><strong>" . MoneyFormat($invoice_total_thispage) . "</strong></td></tr>";
    print "<tr><td colspan=\"5\"><strong>Total Invoices</strong><td style=\"text-align: right\"><strong>" . MoneyFormat($invoice_total) . "</strong></td></tr>";
    print "</table>";
} else {
    print "<p>There are no oustanding invoices on the system.</p>";
}
            $invoice_id = $array_invoice['invoice_id'];
            $invoice_ref = $array_invoice['invoice_ref'];
            echo "<a href=\"index2.php?page=timesheet_invoice_view&amp;invoice_id={$invoice_id}\">{$invoice_ref}</a>";
        } else {
            print "No";
        }
        print "</td></tr>";
        print "<tr><td><strong>Receipt Available?</strong></td><td>";
        if ($ts_expense_receipt == "1") {
            print "Yes";
        } else {
            print "No";
        }
        print "</td></tr>";
        print "<tr><td><strong>Expense Amount </strong>(exc. VAT)</td><td>" . MoneyFormat($ts_expense_value) . "</td></tr>";
        print "<tr><td><strong>Expense Amount </strong>(inc. VAT)</td><td>" . MoneyFormat($ts_expense_vat) . "</td></tr>";
        print "</table>";
    } else {
        print "<p><strong>You are not authorised to view this page.</strong></p>";
    }
} else {
    print "<p><strong>The expenses record you have requested does not exist.</strong></p>";
    if ($user_usertype_current > 3) {
        echo "<p>Try the ";
        if ($ts_expense_id > 1) {
            echo "<a href=\"index2.php?page=timesheet_expense_view&amp;ts_expense_id=" . ($ts_expense_id - 1) . "\">previous</a> ";
        }
        echo "or <a href=\"index2.php?page=timesheet_expense_view&amp;ts_expense_id=" . ($ts_expense_id + 1) . "\">next</a> ";
        echo "reference.</p>";
    }
}