$col2 = 0; $col3 = 0; //$array_duplicate = array('vat' => NULL,'id' => NULL); $array_duplicate = array(); $total_queried = 0; $result_expense = mysql_query($sql_expense, $conn) or die(mysql_error()); while ($array_expense = mysql_fetch_array($result_expense)) { $ts_expense_date_duplicate = $ts_expense_date; $ts_expense_vat_duplicate = $ts_expense_vat; // if ($ts_expense_vat > 50) { array_push($array_duplicate['vat'],$ts_expense_vat); array_push($array_duplicate['id'],$ts_expense_id); } if ($ts_expense_vat > 20) { $array_duplicate[] = $ts_expense_vat; } $ts_expense_id = $array_expense['ts_expense_id']; $ts_expense_value = round($array_expense['ts_expense_value'], 2); $ts_expense_date = TimeFormatBrief($array_expense['ts_expense_date']); $ts_expense_desc = DeCode(RemoveShit($array_expense['ts_expense_desc'])); $ts_expense_vat = $array_expense['ts_expense_vat']; $ts_expense_verified = $array_expense['ts_expense_verified']; $ts_expense_reimburse = $array_expense['ts_expense_reimburse']; $ts_expense_invoice = $array_expense['ts_expense_invoice']; $ts_expense_p11d = $array_expense['ts_expense_p11d']; $proj_fee_track = $array_expense['proj_fee_track']; $proj_num = $array_expense['proj_num']; $expense_cat_name = $array_expense['expense_cat_name']; //check for duplicates if ($ts_expense_vat == $ts_expense_vat_duplicate and $ts_expense_verified == 0 and $show_non_personal == NULL or array_search($ts_expense_vat, $array_duplicate) == TRUE and $ts_expense_verified == 0 and $show_non_personal == NULL) { $ts_expense_desc = $ts_expense_desc . " - <strong>DUPLICATE ENTRY?</strong>"; } if ($array_expense['ts_expense_notes'] != NULL) { $ts_expense_desc = $ts_expense_desc . "<br />[Note: " . $array_expense['ts_expense_notes'] . "]";
if ($ts_expense_invoiced > 0) { $sql_invoice = "SELECT invoice_ref, invoice_id 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_ref = $array_invoice['invoice_ref']; $invoice_id = $array_invoice['invoice_id']; $invoice_ref_print = $invoice_ref . " (" . $invoice_id . ")"; } else { if ($ts_expense_p11d > 0) { $invoice_ref_print = "Personal"; } else { $invoice_ref_print = "Office Expense"; } } $ts_expense_user = $array_expense['ts_expense_user']; if ($array_expense['ts_expense_verified'] > 0) { $ts_expense_verified = TimeFormatBrief($array_expense['ts_expense_verified']); } else { $ts_expense_verified = "-"; } $ts_expense_value = round($array_expense['ts_expense_value'], 2); $ts_expense_vat = round($array_expense['ts_expense_vat'], 2); $ts_expense_receipt = $array_expense['ts_expense_receipt']; $ts_expense_reimburse = $array_expense['ts_expense_reimburse']; $proj_num = $array_expense['proj_num']; if ($ts_expense_invoiced == NULL) { $ts_expense_invoiced = 0; } echo "<tr><td>" . $ts_expense_id . "</td><td>" . $ts_expense_date . "</td><td>" . $proj_num . "</td><td>" . $ts_expense_desc . "</td><td>" . $expense_cat_name . "</td><td>" . $user_name . "</td><td>" . $ts_expense_verified . "</td><td>" . $invoice_ref_print . "</td><td>" . $ts_expense_value . "</td><td>" . $ts_expense_diff_print . "</td><td>" . $ts_expense_vat . "</td></tr>"; } echo "</table>";
print "<tr><td>" . $proj_h2 . "</td>"; } else { $proj_id_current = $proj_id; } if ($ts_expense_p11d == 1) { $p11d_total = $p11d_total + $ts_expense_vat; $ts_expense_desc = "<i>{$ts_expense_desc}</i>"; } print "<td>" . TimeFormatBrief($ts_expense_date) . "</td><td><a href=\"index2.php?page=timesheet_expense_view&ts_expense_id={$ts_expense_id}\">" . $ts_expense_desc . "</a> <a href=\"index2.php?page=timesheet_expense_edit&status=edit&ts_expense_id={$ts_expense_id}\"><img src=\"images/button_edit\" /></a></td><td><a href=\"index2.php?page=user_view&user_id={$user_id}\">{$user_initials}</a></td><td style=\"width: 10%; text-align: right;\">" . $ts_expense_vat_print . "</td>"; $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&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>";