$pdf->addPage();
 $pdf->useTemplate($tplidx);
 $pdf->SetAutoPageBreak(0, 1.5);
 $pdf->AddFont($format_font, '', $format_font_2);
 // Page headers
 $project_counter = 1;
 $page_count = 1;
 $pdf->SetY(35);
 $pdf->SetFont('Helvetica', 'b', 24);
 $pdf->SetTextColor($format_bg_r, $format_bg_g, $format_bg_b);
 $pdf->Cell(0, 10, "Timesheet Analysis");
 $pdf->SetTextColor(0, 0, 0);
 $pdf->SetY(50);
 $pdf->SetFont('Helvetica', 'b', 18);
 $print_title = "Generated " . TimeFormatDetailed(time());
 $print_envelope = "Timesheet Datum: " . TimeFormat($settings_timesheetstart);
 $pdf->SetFillColor(220, 220, 220);
 $pdf->MultiCell(0, 8, $print_title, 0, L, 0);
 $pdf->SetFont('Helvetica', 'b', 12);
 $pdf->MultiCell(0, 5, $print_envelope, 0, L, 0);
 $pdf->MultiCell(0, 5, $print_profit_text, 0, L, 0);
 $pdf->Cell(0, 5, '', 0, 2);
 $pdf->SetFont($format_font, '', 10);
 $pdf->SetTextColor(0, 0, 0);
 // Array through the projects and fee stages
 $bar_width_standard = 130;
 $effectively_zero = 0.1;
 // Sets the minimum bar size if the quantity is zero
 $page_number = 0;
 $complete_profit_total = 0;
 $complete_fee_total = 0;
 $sql_issued = "SELECT * FROM intranet_drawings_issued_set, intranet_drawings, intranet_drawings_issued LEFT JOIN intranet_drawings_revision ON revision_id = issue_revision WHERE drawing_id = {$drawing_id} AND set_id = issue_set AND drawing_id = issue_drawing GROUP BY set_id ORDER BY set_date DESC, issue_revision DESC, set_id DESC";
 $result_issued = mysql_query($sql_issued, $conn) or die(mysql_error());
 echo "<h2>Drawing Issues</h2>";
 if (mysql_num_rows($result_issued) > 0) {
     echo "<table>";
     echo "<tr><th>Issue Date</th><th>Issue Set</th><th>Revision</th><th colspan=\"2\">Issue Status</th></tr>";
     while ($array_issued = mysql_fetch_array($result_issued)) {
         $set_date = $array_issued['set_date'];
         $revision_letter = strtoupper($array_issued['revision_letter']);
         $issue_set = $array_issued['issue_set'];
         $set_reason = $array_issued['set_reason'];
         $set_id = $array_issued['set_id'];
         if ($revision_letter == NULL) {
             $revision_letter = "-";
         }
         echo "<tr><td><a href=\"index2.php?page=datebook_view_day&amp;time={$set_date}\">" . TimeFormat($set_date) . "</a></td><td><a href=\"index2.php?page=drawings_issue_list&amp;set_id={$issue_set}&amp;proj_id={$proj_id}\">{$set_id}</a></td><td>{$revision_letter}</td><td><a href=\"index2.php?page=drawings_issue_list&amp;set_id={$issue_set}&amp;proj_id={$proj_id}\">{$set_reason}</a></td><td style=\"width: 20px;\">&nbsp;<a href=\"pdf_drawing_issue.php?issue_set={$issue_set}&amp;proj_id={$proj_id}\"><img src=\"images/button_pdf.png\" alt=\"PDF drawing issue sheet\" /></a></td></tr>";
     }
     echo "</table>";
 } else {
     echo "<p>This drawing has not been issued.</p>";
 }
 // Drawing issue history
 /* $sql_history = "SELECT * FROM intranet_drawings_issued_set, intranet_user_details, intranet_drawings_issued LEFT JOIN intranet_drawings_revision ON revision_id = issue_revision WHERE issue_set = set_id AND user_id = set_user AND issue_drawing = $_GET[drawing_id] ORDER BY set_date DESC";
 				$result_history = mysql_query($sql_history, $conn) or die(mysql_error());
 			
 				echo "<h2>Issue History</h2>";
 				
 				if (mysql_num_rows($result_history) > 0) {
 					
 					
 						
        echo $contact_postcode;
    }
    echo "</textarea>";
    echo "</fieldset>";
    // List any drawing issues to this contact
    $sql_drawing = "SELECT * FROM intranet_drawings_issued_set, intranet_projects, intranet_drawings_issued LEFT JOIN contacts_companylist ON company_id = issue_company WHERE proj_id = set_project AND issue_contact = {$contact_id} AND issue_set = set_id ORDER BY set_date DESC";
    $current_set = 0;
    $result_drawing = mysql_query($sql_drawing, $conn);
    if (mysql_num_rows($result_drawing) > 0) {
        echo "<fieldset><legend>Drawing Issue</legend>";
        echo "<table>";
        echo "<tr><th>Date</th><th>Project</th><th>Company</th><th>Reason for Issue</th></tr>";
        while ($array_drawing = mysql_fetch_array($result_drawing)) {
            $set_id = $array_drawing['set_id'];
            $set_date = $array_drawing['set_date'];
            $set_reason = $array_drawing['set_reason'];
            $proj_id = $array_drawing['proj_id'];
            $proj_num = $array_drawing['proj_num'];
            $proj_name = $array_drawing['proj_name'];
            $company_id = $array_drawing['company_id'];
            $company_name = $array_drawing['company_name'];
            if ($set_id != $current_set) {
                echo "<tr><td><a href=\"index2.php?page=datebook_view_day&amp;time={$set_date}\">" . TimeFormat($set_date) . "</a></td><td><a href=\"" . $pref_location . "/index2.php?page=project_view&amp;proj_id={$proj_id}\">{$proj_num} {$proj_name}</a></td><td><a href=\"index2.php?page=contacts_company_view&amp;company_id={$company_id}\">{$company_name}</a></td><td><a href=\"index2.php?page=drawings_issue_list&set_id={$set_id}&amp;proj_id={$proj_id}\">{$set_reason}</a></td></tr>";
            }
            $current_set = $set_id;
        }
        echo "</table></fieldset>";
    }
} else {
    header("Location:index2.php");
}
예제 #4
0
function TimeDiff($fstTime, $sndTime)
{
    $fstHour = (int) substr(TimeFormat($fstTime, "24"), 0, 2);
    $sndHour = (int) substr(TimeFormat($sndTime, "24"), 0, 2);
    $fstMinit = (int) substr(TimeFormat($fstTime, "24"), 3, 2);
    $sndMinit = (int) substr(TimeFormat($sndTime, "24"), 3, 2);
    $tmDiff = $sndHour * 60 + $sndMinit - ($fstHour * 60 + $fstMinit);
    if ($tmDiff < 0) {
        $tmDiff = 24 * 60 + $tmDiff;
    }
    $HourDiff = ($tmDiff - $tmDiff % 60) / 60;
    $MinDiff = $tmDiff % 60;
    if (strlen($MinDiff) == 1) {
        $MinDiff = "0" . $MinDiff;
    }
    $tmDiff = $HourDiff . ":" . $MinDiff;
    return $tmDiff;
}
<?php

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>";
예제 #6
0
/**
 * Describe Alert
 * @param array $alert Alert-Result from DB
 * @return array
 */
function DescribeAlert($alert)
{
    $obj = array();
    $i = 0;
    $device = dbFetchRow('SELECT hostname FROM devices WHERE device_id = ?', array($alert['device_id']));
    $obj['hostname'] = $device['hostname'];
    $obj['device_id'] = $alert['device_id'];
    $extra = $alert['details'];
    if ($alert['state'] >= 1) {
        $obj['title'] = 'Alert for device ' . $device['hostname'] . ' - ' . ($alert['name'] ? $alert['name'] : $alert['rule']);
        if ($alert['state'] == 2) {
            $obj['title'] .= ' got acknowledged';
        } else {
            if ($alert['state'] == 3) {
                $obj['title'] .= ' got worse';
            } else {
                if ($alert['state'] == 4) {
                    $obj['title'] .= ' got better';
                }
            }
        }
        foreach ($extra['rule'] as $incident) {
            $i++;
            $obj['faults'][$i] = $incident;
            foreach ($incident as $k => $v) {
                if (!empty($v) && $k != 'device_id' && (stristr($k, 'id') || stristr($k, 'desc') || stristr($k, 'msg')) && substr_count($k, '_') <= 1) {
                    $obj['faults'][$i]['string'] .= $k . ' => ' . $v . '; ';
                }
            }
        }
    } else {
        if ($alert['state'] == 0) {
            $id = dbFetchRow('SELECT alert_log.id,alert_log.time_logged,alert_log.details FROM alert_log WHERE alert_log.state != 2 && alert_log.state != 0 && alert_log.rule_id = ? && alert_log.device_id = ? && alert_log.id < ? ORDER BY id DESC LIMIT 1', array($alert['rule_id'], $alert['device_id'], $alert['id']));
            if (empty($id['id'])) {
                return false;
            }
            $extra = json_decode(gzuncompress($id['details']), true);
            $obj['title'] = 'Device ' . $device['hostname'] . ' recovered from ' . ($alert['name'] ? $alert['name'] : $alert['rule']);
            $obj['elapsed'] = TimeFormat(strtotime($alert['time_logged']) - strtotime($id['time_logged']));
            $obj['id'] = $id['id'];
            $obj['faults'] = false;
        } else {
            return 'Unknown State';
        }
    }
    //end if
    $obj['uid'] = $alert['id'];
    $obj['severity'] = $alert['severity'];
    $obj['rule'] = $alert['rule'];
    $obj['name'] = $alert['name'];
    $obj['timestamp'] = $alert['time_logged'];
    $obj['contacts'] = $extra['contacts'];
    $obj['state'] = $alert['state'];
    return $obj;
}
예제 #7
0
$sql3 = "SELECT invoice_id, invoice_ref, proj_name FROM intranet_timesheet_invoice, intranet_projects WHERE `invoice_date` BETWEEN '{$day_begin}' AND '{$day_end}' AND `proj_rep_black` = '{$_COOKIE['user']}' AND `proj_id` = `invoice_project` ORDER BY `invoice_ref` ";
$result3 = mysql_query($sql3, $conn) or die(mysql_error());
if (mysql_num_rows($result3) > 0) {
    $invoicemessage = "<table>";
    while ($array3 = mysql_fetch_array($result3)) {
        $invoicemessage = $invoicemessage . "<tr><td><a href=\"index2.php?page=timesheet_invoice_view&amp;invoice_id=" . $array3['invoice_id'] . "\">" . $array3['invoice_ref'] . "</a></td><td>" . $array3['proj_name'] . "</td></tr>";
    }
    $invoicemessage = $invoicemessage . "</table>";
}
// Check for any invoices overdue
$sql4 = "SELECT invoice_id, invoice_ref, proj_name, invoice_due FROM intranet_timesheet_invoice, intranet_projects WHERE `invoice_due` < " . time() . " AND `proj_rep_black` = '{$_COOKIE['user']}' AND `proj_id` = `invoice_project` AND `invoice_paid` = 0 AND `invoice_baddebt` != 'yes' ORDER BY `invoice_due` ";
$result4 = mysql_query($sql4, $conn) or die(mysql_error());
if (mysql_num_rows($result4) > 0) {
    $invoiceduemessage = "<table>";
    while ($array4 = mysql_fetch_array($result4)) {
        $invoiceduemessage = $invoiceduemessage . "<tr><td><a href=\"index2.php?page=timesheet_invoice_view&amp;invoice_id=" . $array4['invoice_id'] . "\">" . $array4['invoice_ref'] . "</a></td><td>" . $array4['proj_name'] . "</td><td>Due: <a href=\"index2.php?page=datebook_view_day&amp;time=" . $array4['invoice_due'] . "\"> " . TimeFormat($array4['invoice_due']) . "</a></td></tr>";
    }
    $invoiceduemessage = $invoiceduemessage . "</table>";
}
// Check for any checklist deadlines today
$today_date = date("Y-m-d", time());
$sql5 = "SELECT * FROM intranet_projects, intranet_project_checklist LEFT JOIN intranet_project_checklist_items ON checklist_item = item_id  WHERE proj_id = checklist_project AND checklist_deadline = '{$today_date}' ORDER BY item_group, item_order, checklist_date, item_name";
$result5 = mysql_query($sql5, $conn) or die(mysql_error());
if (mysql_num_rows($result5) > 0) {
    $checklist_today = "<table>";
    while ($array5 = mysql_fetch_array($result5)) {
        $checklist_today = $checklist_today . "<tr><td style=\"width: 30%;\"><a href=\"index2.php?page=project_checklist&amp;proj_id=" . $array5['proj_id'] . "#" . $array5['item_id'] . "\">" . $array5['item_name'] . "</a></td><td>" . $array5['proj_num'] . " " . $array5['proj_name'] . "</td></tr>";
    }
    $checklist_today = $checklist_today . "</table>";
} else {
    unset($checklist_today);
            $type++;
        } elseif ($blog_type == "filenote") {
            $blog_type_view = "File Note";
            $type++;
        } elseif ($blog_type == "meeting") {
            $blog_type_view = "Meeting Note";
            $type++;
        } elseif ($blog_type == "email") {
            $blog_type_view = "Email Message";
            $type++;
        } else {
            $blog_type_view = NULL;
            $type = 0;
        }
        $blog_type_list = array("phone", "filenote", "meeting", "email");
        if ($counter >= $limit and $counter < $page_next) {
            $counter_title++;
            print "<tr>";
            print "<td>{$type}.</td><td><a href=\"index2.php?page=project_blog_view&amp;blog_id={$blog_id}&amp;proj_id={$proj_id}\">" . $blog_title . "</a>&nbsp;<a href=\"pdf_journal.php?blog_id={$blog_id}\"><img src=\"images/button_pdf.png\" /></a></td>";
            print "<td style=\"width: 20%;\"><a href=\"index2.php?page=datebook_view_day&amp;time={$blog_date}\">" . TimeFormat($blog_date) . "</a></td>";
            print "<td><a href=\"index2.php?page=user_view&amp;user_id={$user_id}\">" . $blog_user_name_first . "&nbsp;" . $blog_user_name_second . "</a></td>";
            print "<td style=\"width: 20%;\"><span class=\"minitext\">{$blog_type_view}</span></td>";
            print "</tr>";
        }
        $title = $blog_type;
        $counter++;
    }
    print "</table>";
} else {
    print "<p>There are no journal entries on the system for this project.</p>";
}
 echo "<tr><th style=\"width:25%\">Number</th><th style=\"width:20%\">Rev.</th><th>Rev. Date</th><th colspan=\"2\">Title</th></tr>";
 unset($current_drawing);
 unset($issue_id_prev);
 while ($array_drawings = mysql_fetch_array($result_drawings)) {
     $drawing_id = $array_drawings['drawing_id'];
     $drawing_title = $array_drawings['drawing_title'];
     $drawing_number = $array_drawings['drawing_number'];
     $drawing_description = str_replace("\n", ", ", $array_drawings['drawing_description']);
     $revision_letter = $array_drawings['revision_letter'];
     $issue_id = $array_drawings['issue_id'];
     $issue_drawing = $array_drawings['issue_drawing'];
     if ($revision_letter == NULL) {
         $revision_letter = "-";
     }
     if ($revision_date > 0) {
         $revision_date = TimeFormat($array_drawings['revision_date']);
     } else {
         $revision_date = "-";
     }
     //if (time() - ) {
     //$delete_button = "<a href=\"index2.php?page=drawings_issue_list&amp;set_id=$set_id&amp;proj_id=$proj_id&amp;issue_drawing=$issue_drawing&amp;action=drawing_issue_item_delete#$issue_id_prev\"><img src=\"images\button_delete.png\" alt=\"Delete this entry\" /></a>";
     //}
     if ($current_drawing != $drawing_id) {
         echo "<tr id=\"{$issue_id}\"><td><a href=\"index2.php?page=drawings_detailed&amp;drawing_id={$drawing_id}&amp;proj_id={$proj_id}\">{$drawing_number}</a><td>" . strtoupper($revision_letter) . "</td><td>{$revision_date}</td><td>{$drawing_title}</td><td>" . $delete_button . "</td></tr>";
     }
     $current_drawing = $drawing_id;
     $issue_id_prev = $issue_id;
 }
 echo "</table></fieldset>";
 // Recipients of drawings
 $sql_contacts = "SELECT * FROM contacts_contactlist, intranet_contacts_project, intranet_drawings_issued\nLEFT JOIN contacts_companylist\nON company_id = issue_company\nWHERE issue_set = {$set_id}\nAND issue_contact = contact_id\nAND contact_proj_contact = contacts_contactlist.contact_id\nAND contact_proj_project = {$proj_id}\nORDER BY company_name, contact_namesecond\n";
 $ts_expense_id = $array['ts_expense_id'];
 $ts_expense_invoiced = $array['ts_expense_invoiced'];
 $ts_expense_reimburse = $array['ts_expense_reimburse'];
 $ts_expense_notes = $array['ts_expense_notes'];
 $ts_expense_p11d = $array['ts_expense_p11d'];
 $proj_id = $array['proj_id'];
 $proj_num = $array['proj_num'];
 $proj_name = $array['proj_name'];
 $proj_fee_track = $array['proj_fee_track'];
 if ($ts_expense_p11d > 0) {
     $bg = "style=\"background-color: #8EC799;\"";
 } else {
     $bg = NULL;
 }
 $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>";
            print " selected";
        }
        print ">{$blog_title_link} (" . TimeFormat($blog_date_link) . ")</option>";
    }
    print "</select></p>";
}
// Link this entry with a task
$sql4 = "SELECT tasklist_id, tasklist_notes, tasklist_added FROM intranet_tasklist WHERE tasklist_project = '{$proj_id}' AND tasklist_person = '{$_COOKIE['user']}' order by tasklist_due DESC";
$result4 = mysql_query($sql4, $conn);
if (mysql_num_rows($result4) > 0) {
    print "<h3>Link with task</h3><p><select name=\"blog_task\">";
    print "<option value=\"\">-- None --</option>";
    while ($array4 = mysql_fetch_array($result4)) {
        $task_id = $array4['tasklist_id'];
        $task_added = $array4['tasklist_added'];
        $task_notes = "[Added " . TimeFormat($task_added) . "] - " . substr($array4['tasklist_notes'], 0, 60) . "...";
        print "<option value=\"{$task_id}\"";
        if ($task_id == $blog_task) {
            print " selected";
        }
        print ">{$task_notes}</option>";
    }
    print "</select></p>";
}
// Hidden values
$nowtime = time();
$hour = 7;
$day = 1;
$month = 1;
$month_array = array("", "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
$year = 1;
        if ($tasklist_completed > 0) {
            $tasklist_completed_text = "(Completed " . TimeFormat($tasklist_completed) . ")";
            $strike = "<span style=\"text-decoration: line-through;\">";
            $strike2 = "</span>";
        } else {
            $tasklist_completed_text = NULL;
            $strike = NULL;
            $strike2 = NULL;
        }
        print "<tr><td style=\"width: 50px; {$highlight}\">{$strike}<a href=\"index2.php?page=project_view&amp;proj_id={$proj_id}\">{$proj_num}</a>{$strike2}</td><td style=\"{$highlight}\">{$strike}<a href=\"index2.php?page=tasklist_detail&amp;tasklist_id={$tasklist_id}&amp;time={$tasklist_due}\">{$tasklist_notes}</a>{$strike2}&nbsp;{$tasklist_completed_text}</td><td style=\"{$highlight}\">{$strike}<a href=\"index2.php?page=user_view&amp;user_id={$user_id}\">{$user_name_first}&nbsp;{$user_name_second}</a>{$strike2}</td></tr>";
    }
    print "</table>";
}
// Journal entries
print "<h2>Journal Entries &amp; Telephone Messages</h2>";
print "<table summary=\"Datebook for " . TimeFormat($time) . "\">";
while ($count < $hour_begin + $hour_end) {
    $startday_next = $startday + 3599;
    print "<tr><td colspan=\"3\"><strong>";
    print date("g.00a", $startday);
    print "</strong></td></tr>";
    $type_find = array("phone", "filenote", "meeting", "email");
    $type_replace = array("Telephone Call", "File Note", "Meeting Note", "Email Message");
    $sql_blog = "SELECT blog_id, blog_title, blog_date, blog_type, proj_num, proj_id FROM intranet_projects_blog, intranet_projects WHERE proj_id = blog_proj AND blog_date BETWEEN '{$startday}' AND '{$startday_next}' ORDER BY '{$blog_date}'";
    $result_blog = mysql_query($sql_blog, $conn) or die(mysql_error());
    while ($array_blog = mysql_fetch_array($result_blog)) {
        $blog_id = $array_blog['blog_id'];
        $blog_title = $array_blog['blog_title'];
        $blog_date = $array_blog['blog_date'];
        $blog_type = $array_blog['blog_type'];
        $proj_id = $array_blog['proj_id'];
    print "<a href=\"index2.php?page=tender_list\" class=\"submenu_bar\">Hide Details</a>";
}
print "</p>";
print "<h2>Tender List</h2>";
if (mysql_num_rows($result) > 0) {
    $time_line = NULL;
    print "<table summary=\"Lists of tenders\">";
    while ($array = mysql_fetch_array($result)) {
        $tender_id = $array['tender_id'];
        $tender_name = $array['tender_name'] . "&nbsp;(" . $array['tender_type'] . ")";
        $tender_date = $array['tender_date'];
        $tender_client = $array['tender_client'];
        $tender_description = nl2br($array['tender_description']);
        $tender_keywords = $array['tender_keywords'];
        if ($nowtime > $tender_date && $nowtime < $time_line) {
            echo "<tr><td colspan=\"2\" style=\"background: red; color: white; text-align: right;\">Today is " . TimeFormat($nowtime) . "</td></tr>";
        }
        if ($tender_date - $nowtime < 86400 && $tender_date - $nowtime > 0) {
            $style = "style=\"background: orange;\"";
        } else {
            unset($style);
        }
        echo "<tr><th colspan=\"2\" {$style} ><a href=\"index2.php?page=tender_view&amp;tender_id={$tender_id}\">{$tender_name}</a></th></tr>";
        echo "<tr><td {$style} >" . date("d M Y", $tender_date) . "</td><td {$style}>{$tender_client}</td></tr>";
        if ($detail == "yes") {
            echo "<tr><td colspan=\"2\" {$style} >{$tender_description}</td></tr>";
        }
        if ($detail == "yes") {
            echo "<tr><td colspan=\"2\" {$style} ><span class=\"minitext\">Keywords:&nbsp;";
            KeyWords($tender_keywords);
            echo "</span></td></tr>";
         $highlight2 = "; background-color: #{$settings_alertcolor}";
     } else {
         unset($highlight);
         unset($highlight2);
         $invoice_total_due = $invoice_total_due + $invoice_value;
     }
     if ($counter >= $limit and $counter < $page_next) {
         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}&amp;page_refer=timesheet_invoice_view_paid\"><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 "</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 style=\"text-align: center{$highlight2}\">{$invoice_account}</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 {$page_title}</strong><td style=\"text-align: right\"><strong>" . MoneyFormat($invoice_total) . "</strong></td></tr>";
 $sql_acc = "SELECT * FROM intranet_account order by account_id";
 $result_acc = mysql_query($sql_acc, $conn) or die(mysql_error());
 if (mysql_num_rows($result_acc) > 0) {
     print "<tr><td colspan=\"6\"><p>Account Details:</p><p>";
     while ($array_acc = mysql_fetch_array($result_acc)) {
            }
            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']);
            $answer_tender_id = $array['answer_tender_id'];
            $answer_tender_id = $array['answer_tender_id'];
            $answer_ref = $array['answer_ref'];
            $tender_name = $array['tender_name'];
            $tender_date = $array['tender_date'];
            echo "<tr><td>";
            echo "<a href=\"index2.php?page=tender_view&amp;tender_id={$answer_tender_id}&amp;answer_id={$answer_id}\">" . substr($answer_response, 0, 200) . "...</a><br /><span class=\"minitext\">From {$tender_name}, " . TimeFormat($tender_date) . ", question {$answer_ref}</span>";
            print "</td></tr>";
        }
    }
    echo "</table>";
} else {
    print "<p>Invalid Search Term</p>";
}
} else {
    $TSPage = "index2.php?page=timesheet_edit&amp;";
}
$ts_list_total = 0;
$ts_cost_total = 0;
$week_complete_check = 1;
// Any functions?
function PresentCost($input)
{
    $output = "&pound;" . numberformat($input, 2);
    return $output;
}
// Begin the daily loop
$ts_day_begin = $ts_weekbegin;
$ts_day_end = $ts_day_begin + 86400;
print "<table summary=\"Timesheet for week beginning" . TimeFormat($_GET[week]) . "\">";
print "<tr><th style=\"width: 30%;\"><strong>Project</strong></th><th style=\"width: 15%;\"><strong>Day</strong></th><th><strong>Description</strong></th><th><strong>Hours</strong></th>";
if ($user_usertype_current > 3) {
    echo "<th>Cost</th>";
}
echo "</tr>";
$color = 1;
for ($weekcount = 0; $weekcount <= 6; $weekcount++) {
    if ($weekcount == 0) {
        $dayname = "Monday";
    } elseif ($weekcount == 1) {
        $dayname = "Tuesday";
    } elseif ($weekcount == 2) {
        $dayname = "Wednesday";
    } elseif ($weekcount == 3) {
        $dayname = "Thursday";
     $border = "T";
 } else {
     $border = "0";
 }
 $sql_rev = "SELECT * FROM intranet_drawings_revision WHERE revision_drawing = '{$drawing_id}' ORDER BY revision_letter DESC LIMIT 1";
 $result_rev = mysql_query($sql_rev, $conn) or die(mysql_error());
 $array_rev = mysql_fetch_array($result_rev);
 if ($array_rev['revision_letter'] != NULL) {
     $revision_letter = strtoupper($array_rev['revision_letter']);
 } else {
     $revision_letter = " - ";
 }
 if ($array_rev['revision_date'] != NULL) {
     $revision_date = TimeFormat($array_rev['revision_date']);
 } elseif ($drawing_date > 0) {
     $revision_date = TimeFormat($drawing_date);
 } else {
     $revision_date = " - ";
 }
 if ($pdf->GetStringWidth($drawing_title) > 100) {
     $drawing_title = substr($drawing_title, 0, 80) . "...";
 }
 $sql_issued = "SELECT issue_id FROM intranet_drawings_issued WHERE issue_drawing = '{$drawing_id}' LIMIT 1";
 $result_issued = mysql_query($sql_issued, $conn) or die(mysql_error());
 if (mysql_num_rows($result_issued) > 0) {
     $pdf->SetTextColor(0, 0, 0);
 } else {
     $pdf->SetTextColor(150, 150, 150);
     $not_issued = "*Drawings shown in light grey have not yet been issued.";
     $drawing_number = $drawing_number . "*";
 }
 if ($invoice_baddebt == "yes") {
     echo "<tr><td colspan=\"4\" {$highlight}><strong>Listed as a bad debt</strong></td></tr>";
 }
 print "<tr>";
 print "<td {$highlight} rowspan=\"{$rowspan}\" style=\"width: 25%;\"><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}\" {$confirm}><img src=\"images/button_edit.png\" alt=\"Edit Invoice\" /></a>";
 }
 if ($invoice_notes != NULL) {
     echo "<br />" . TextPresent($invoice_notes);
 }
 print "</td>";
 print "<td {$highlight}>" . TimeFormat($invoice_date) . "</td>";
 print "<td {$highlight}>" . TimeFormat($invoice_due) . "</td>";
 if ($invoice_paid > 0) {
     print "<td {$highlight}>" . TimeFormat($invoice_paid) . "</td>";
 } else {
     print "<td {$highlight}></td>";
 }
 print "</tr>";
 // Output the Invoice Item details
 if (mysql_num_rows($result2) > 0) {
     while ($array2 = mysql_fetch_array($result2)) {
         $invoice_item_novat = $array2['invoice_item_novat'];
         $invoice_item_vat = $array2['invoice_item_vat'];
         if ($invoice_paid > 0) {
             $invoice_total_paid = $invoice_total_paid + $invoice_item_novat;
         }
         $invoice_item_vat_total = $invoice_item_vat_total + $invoice_item_vat;
         $invoice_item_total = $invoice_item_total + $invoice_item_novat;
         $invoice_total_all = $invoice_total_all + $invoice_item_novat;
$user_name_first = $array_project['user_name_first'];
$user_name_second = $array_project['user_name_second'];
if ($blog_type == "phone") {
    $blog_type_view = "Telephone Call";
} elseif ($blog_type == "filenote") {
    $blog_type_view = "File Note";
} elseif ($blog_type == "meeting") {
    $blog_type_view = "Meeting Note";
} elseif ($blog_type == "email") {
    $blog_type_view = "Email Message";
} else {
    $blog_type_view = NULL;
    $type = 0;
}
$blog_type_view = $blog_type_view . " - " . $user_name_first . " " . $user_name_second;
$pdf->SetXY(10, 45);
$pdf->SetFont($format_font, '', 14);
$pdf->SetTextColor(200, 200, 200);
$sheet_subtitle = $proj_num . " " . $proj_name . ", " . TimeFormat($blog_date);
$pdf->Cell(0, 7.5, $sheet_subtitle, 0, 1, L, 0);
$pdf->Cell(0, 7.5, $blog_type_view, 0, 1, L, 0);
$pdf->SetFont($format_font, '', 24);
$pdf->SetTextColor(150, 150, 150);
$pdf->MultiCell(0, 8, $blog_title, 0, L);
$pdf->SetXY(40, 85);
$pdf->SetFont($format_font, '', 11);
$pdf->SetTextColor(0, 0, 0);
$pdf->MultiCell(0, 5, $blog_text, 0, L);
// and send to output
$file_name = $proj_num . "_" . Date("Y", $blog_date) . "-" . Date("m", $blog_date) . "-" . Date("d", $blog_date) . "_" . $blog_type . ".pdf";
$pdf->Output($file_name, I);
     echo "<td style=\"{$highlight}\">" . $proj_duration_print . "</td>";
     if ($user_usertype_current > 2) {
         echo "<td style=\"{$highlight}\"><a href=\"index2.php?page=timesheet_fees_edit&amp;ts_fee_id={$ts_fee_id}\"><img src=\"images/button_edit.png\" alt=\"Edit\" /></a></td>";
     }
     echo "</tr>";
     // Include a line if the invoice has been issued
     if ($invoice_id > 0) {
         echo "<tr>";
         if ($user_usertype_current > 2) {
             echo "<td colspan=\"5\">";
         } else {
             echo "<td colspan=\"4\">";
         }
         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>";
예제 #21
0
 $y = $y + 8;
 $x = 40;
 $pdf->SetXY($x, $y);
 $sql3 = "SELECT * FROM intranet_timesheet_expense LEFT JOIN intranet_user_details ON user_id = ts_expense_user WHERE ts_expense_invoiced = '{$invoice_id}' AND ts_expense_disbursement <> '1' ORDER BY ts_expense_date";
 $result3 = mysql_query($sql3, $conn) or die(mysql_error());
 $count_disbursement = 0;
 while ($array3 = mysql_fetch_array($result3)) {
     $ts_expense_desc = html_entity_decode($array3['ts_expense_desc']);
     $user_initials = $array3['user_initials'];
     $ts_expense_reimburse = $array3['ts_expense_reimburse'];
     $ts_expense_desc = RemoveShit($array3['ts_expense_desc']);
     if ($ts_expense_reimburse == 1) {
         $ts_expense_desc = $ts_expense_desc . " (" . $user_initials . ") ";
     }
     if ($viewall == "yes") {
         $ts_expense_desc = $ts_expense_desc . " (" . TimeFormat($array3['ts_expense_date']) . ")";
     }
     if ($viewall == "yes") {
         $ts_expense_desc = $array3['ts_expense_id'] . ". " . ($ts_expense_desc = $ts_expense_desc);
     }
     $ts_disbursement_vat = $array3['ts_expense_vat'];
     $ts_disbursement_print = CashFormat($ts_disbursement_vat);
     $ts_disbursement_total = $ts_disbursement_total + $ts_disbursement_vat;
     $pdf->MultiCell(100, 4, $ts_expense_desc, 0, 'L');
     $y_new = $pdf->GetY();
     $pdf->SetXY(140, $y);
     $pdf->MultiCell(50, 4, $ts_disbursement_print, '', R);
     $y = $y_new + 1;
     //InsertPage();
     $pdf->SetXY($x, $y);
     $count_disbursement++;
$array_order = array("");
while ($array_riba2 = mysql_fetch_array($result_riba2)) {
    array_push($array_order, $array_riba2["riba_order"]);
}
print $riba_order_array[1];
// Number of columns
$riba_columns = mysql_num_rows($result_riba);
// Menu
print "<p class=\"submenu_bar\">";
if ($user_usertype_current > 4) {
    print "<a href=\"index2.php?\" class=\"submenu_bar\">Project List</a>";
    print "<a href=\"index2.php?page=project_edit&amp;status=add\" class=\"submenu_bar\">Add Project</a>";
}
print "</p>";
// Page sub title
print "<h2>Live Projects as of " . TimeFormat(time()) . "</h2>";
// Table header
if (mysql_num_rows($result) > 0) {
    print "<table summary=\"Lists all of the current, active projects and the currernt stage\">";
    // Output a series of cells containing each of the RIBA stages
    print "<tr><td colspan=\"3\"></td>";
    while ($array_riba = mysql_fetch_array($result_riba)) {
        print "<td style=\"width: 20px;\">";
        print $array_riba['riba_letter'];
        print "</td>";
    }
    print "</tr>";
    // List of projects
    $sql = "SELECT * FROM intranet_projects WHERE proj_active = 1 AND proj_fee_track = 1 order by proj_num";
    $result = mysql_query($sql, $conn) or die(mysql_error());
    while ($array = mysql_fetch_array($result)) {
require 'fpdf/fpdi.php';
$pdf = new fpdi();
$pagecount = $pdf->setSourceFile("pdf/template.pdf");
$tplidx = $pdf->ImportPage(1);
$pdf->addPage();
$pdf->useTemplate($tplidx, 0, 0, 210, 297);
$format_font = "century";
$format_font_2 = "Century.php";
$pdf->AddFont($format_font, '', $format_font_2);
$format_bg_r = "220";
$format_bg_g = "220";
$format_bg_b = "220";
$format_ln_r = "220";
$format_ln_g = "220";
$format_ln_b = "220";
$current_date = TimeFormat(time());
$proj_id = CleanUp($_GET[proj_id]);
// Begin creating the page
//Page Title
$sql_proj = "SELECT * FROM intranet_projects WHERE proj_id = {$proj_id} LIMIT 1";
$result_proj = mysql_query($sql_proj, $conn) or die(mysql_error());
$array_proj = mysql_fetch_array($result_proj);
$proj_num = $array_proj['proj_num'];
$proj_name = $array_proj['proj_name'];
$sheet_title = "Project Checklist";
$pdf->SetXY(10, 45);
$pdf->SetFont($format_font, '', 24);
$pdf->SetTextColor(0, 0, 0);
$pdf->SetDrawColor(0, 0, 0);
$pdf->Cell(0, 10, $sheet_title);
$pdf->SetXY(10, 55);
    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>";
}
예제 #25
0
파일: alerts.php 프로젝트: HenocKA/librenms
/**
 * Describe Alert
 * @param array $alert Alert-Result from DB
 * @return array
 */
function DescribeAlert($alert)
{
    $obj = array();
    $i = 0;
    $device = dbFetchRow('SELECT hostname FROM devices WHERE device_id = ?', array($alert['device_id']));
    $tpl = dbFetchRow('SELECT `template`,`title`,`title_rec` FROM `alert_templates` JOIN `alert_template_map` ON `alert_template_map`.`alert_templates_id`=`alert_templates`.`id` WHERE `alert_template_map`.`alert_rule_id`=?', array($alert['rule_id']));
    $default_tpl = "%title\r\nSeverity: %severity\r\n{if %state == 0}Time elapsed: %elapsed\r\n{/if}Timestamp: %timestamp\r\nUnique-ID: %uid\r\nRule: {if %name}%name{else}%rule{/if}\r\n{if %faults}Faults:\r\n{foreach %faults}  #%key: %value.string\r\n{/foreach}{/if}Alert sent to: {foreach %contacts}%value <%key> {/foreach}";
    $obj['hostname'] = $device['hostname'];
    $obj['device_id'] = $alert['device_id'];
    $extra = $alert['details'];
    if (!isset($tpl['template'])) {
        $obj['template'] = $default_tpl;
    } else {
        $obj['template'] = $tpl['template'];
    }
    if ($alert['state'] >= 1) {
        if (!empty($tpl['title'])) {
            $obj['title'] = $tpl['title'];
        } else {
            $obj['title'] = 'Alert for device ' . $device['hostname'] . ' - ' . ($alert['name'] ? $alert['name'] : $alert['rule']);
        }
        if ($alert['state'] == 2) {
            $obj['title'] .= ' got acknowledged';
        } elseif ($alert['state'] == 3) {
            $obj['title'] .= ' got worse';
        } elseif ($alert['state'] == 4) {
            $obj['title'] .= ' got better';
        }
        foreach ($extra['rule'] as $incident) {
            $i++;
            $obj['faults'][$i] = $incident;
            foreach ($incident as $k => $v) {
                if (!empty($v) && $k != 'device_id' && (stristr($k, 'id') || stristr($k, 'desc') || stristr($k, 'msg')) && substr_count($k, '_') <= 1) {
                    $obj['faults'][$i]['string'] .= $k . ' => ' . $v . '; ';
                }
            }
        }
        $obj['elapsed'] = TimeFormat(time() - strtotime($alert['time_logged']));
        if (!empty($extra['diff'])) {
            $obj['diff'] = $extra['diff'];
        }
    } elseif ($alert['state'] == 0) {
        $id = dbFetchRow('SELECT alert_log.id,alert_log.time_logged,alert_log.details FROM alert_log WHERE alert_log.state != 2 && alert_log.state != 0 && alert_log.rule_id = ? && alert_log.device_id = ? && alert_log.id < ? ORDER BY id DESC LIMIT 1', array($alert['rule_id'], $alert['device_id'], $alert['id']));
        if (empty($id['id'])) {
            return false;
        }
        $extra = json_decode(gzuncompress($id['details']), true);
        if (!empty($tpl['title_rec'])) {
            $obj['title'] = $tpl['title_rec'];
        } else {
            $obj['title'] = 'Device ' . $device['hostname'] . ' recovered from ' . ($alert['name'] ? $alert['name'] : $alert['rule']);
        }
        $obj['elapsed'] = TimeFormat(strtotime($alert['time_logged']) - strtotime($id['time_logged']));
        $obj['id'] = $id['id'];
        $obj['faults'] = false;
    } else {
        return 'Unknown State';
    }
    //end if
    $obj['uid'] = $alert['id'];
    $obj['severity'] = $alert['severity'];
    $obj['rule'] = $alert['rule'];
    $obj['name'] = $alert['name'];
    $obj['timestamp'] = $alert['time_logged'];
    $obj['contacts'] = $extra['contacts'];
    $obj['state'] = $alert['state'];
    if (strstr($obj['title'], '%')) {
        $obj['title'] = RunJail('$ret = "' . populate(addslashes($obj['title'])) . '";', $obj);
    }
    return $obj;
}
echo "<h3>Date of fee stage commencement</h3>";
echo "<p><input type=\"date\" name=\"ts_fee_commence\" value=\"{$ts_fee_commence}\" /></p>";
echo "</fieldset>";
if ($ts_fee_id != "" && $proj_active == 1) {
    echo "<fieldset><legend>Change Project</legend><p>You can move this fee stage to another project here:</p>";
    $data_project = $ts_fee_project;
    $result_data = "ts_fee_project";
    include_once "dropdowns/inc_data_dropdown_projects.php";
} else {
    echo "<input type=\"hidden\" name=\"ts_fee_project\" value=\"{$ts_fee_project}\" />";
}
echo "</fieldset>";
if ($ts_fee_id > 0) {
    echo "<fieldset><legend>Datum</legend>";
    if ($ts_datum_commence != NULL) {
        echo "<p>Current Datum: " . TimeFormat(AssessDays($ts_datum_commence)) . " to " . TimeFormat(AssessDays($ts_datum_commence) + $ts_datum_length) . "</p>";
    }
    if ($ts_datum_commence == NULL) {
        $checked = " checked=\"checked\" ";
    } else {
        unset($checked);
    }
    echo "<p><input type=\"checkbox\" value=\"1\" name=\"datum\" {$checked} />&nbsp;Reset the datum to these new dates?</p>";
    echo "</fieldset>";
}
echo "<fieldset><legend>Change Project</legend>";
echo "<p>You can move this fee stage to another project by selecting it from below. Note that this will break any links with other fee stages in the current project.</p>";
$sql6 = "SELECT proj_num, proj_name, proj_id FROM intranet_projects WHERE proj_active = 1 ORDER BY proj_num DESC";
$result6 = mysql_query($sql6, $conn) or die(mysql_error());
echo "<select name=\"ts_fee_proj_change\">";
while ($array6 = mysql_fetch_array($result6)) {
        print "<p><a href=\"index2.php?page=datebook_view_day&amp;time={$blog_date_link}\">" . TimeFormat($blog_date_link) . "</a> - <a href=\"index2.php?page=project_blog_view&amp;blog_id={$blog_id_link}&amp;proj_id={$proj_id}\">" . $blog_title_link . "</a></p>";
    }
    // Blogs that link to this entry
    $sql3 = "SELECT * FROM intranet_projects_blog WHERE blog_link = '{$blog_id}' ORDER BY blog_date DESC";
    $result3 = mysql_query($sql3, $conn);
    if (mysql_num_rows($result3) > 0) {
        print "<h3>Links to this entry</h3>";
        while ($array3 = mysql_fetch_array($result3)) {
            $blog_id_linkto = $array3['blog_id'];
            $blog_date_linkto = $array3['blog_date'];
            $blog_title_linkto = $array3['blog_title'];
            print "<p><a href=\"index2.php?page=datebook_view_day&amp;time={$blog_date_linkto}\">" . TimeFormat($blog_date_linkto) . "</a> - <a href=\"index2.php?page=project_blog_view&amp;blog_id={$blog_id_linkto}&amp;proj_id={$proj_id}\">" . $blog_title_linkto . "</a></p>";
        }
    }
    // Tasks related to this entry
    if ($blog_task > 0) {
        $sql4 = "SELECT * FROM intranet_tasklist WHERE tasklist_id = '{$blog_task}'";
        $result4 = mysql_query($sql4, $conn);
        $array4 = mysql_fetch_array($result4);
        print "<h3>Tasks related to this entry</h3>";
        $tasklist_id = $array4['tasklist_id'];
        $tasklist_notes = $array4['tasklist_notes'];
        $tasklist_due = $array4['tasklist_due'];
        print "<p><a href=\"index2.php?page=tasklist_detail&amp;tasklist_id={$tasklist_id}\">{$tasklist_notes}</a><br />Due: <a href=\"index2.php?page=datebook_view_day&amp;time={$tasklist_due}\">" . TimeFormat($tasklist_due) . "</a></p>";
    }
}
?>



 $ts_expense_vat = $array['ts_expense_vat'];
 $ts_expense_id = $array['ts_expense_id'];
 $ts_expense_invoiced = $array['ts_expense_invoiced'];
 if ($ts_expense_verified == NULL) {
     $ts_expense_verified = 0;
 }
 print "<tr>";
 print "<td>" . TimeFormat($ts_expense_date) . "</td>";
 print "<td><a href=\"index2.php?page=timesheet_expense_view&amp;ts_expense_id={$ts_expense_id}\">" . $ts_expense_desc . "</a>";
 if ($user_usertype_current > 3 and $ts_expense_verified == 0 or $ts_expense_user == $user_id_current and $ts_expense_verified == 0 or $proj_rep_black == $_COOKIE[user] and $ts_expense_verified == 0) {
     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\" /></a>";
 }
 print "</td>";
 print "<td>";
 if ($ts_expense_verified > 0) {
     print "<a href=\"index2.php?page=timesheet_expense_list_verified&amp;time={$ts_expense_verified}\">" . TimeFormat($ts_expense_verified) . "</a>";
 } else {
     print "No";
 }
 print "</td>";
 // Invoice Details
 $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";
            unset($highlight);
            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>";
                echo " checked=\"checked\" ";
            }
            echo "/>" . $input . "%&nbsp;";
        }
        $count = 0;
        echo "<p>";
        while ($count <= 100) {
            PercentClick($count);
            $count = $count + 10;
        }
        echo "</p>";
    } else {
        print "\n\t\t\t\t\t\t\t<img src=\"images/{$tasklist_percentage_graph}\" width=\"225\" height=\"17\" alt=\"Percentage Complete\" />";
    }
    print "</p>";
    print "<p><strong>Added</strong><br /><a href=\"index2.php?page=datebook_view_day&amp;time={$tasklist_added}\">" . TimeFormat($tasklist_added) . "</a></p>";
}
if ($user_id == $_COOKIE[user] or $user_usertype_current > 3) {
    print "<p>";
    print "<textarea name=\"tasklist_comment\" rows=\"8\" cols=\"36\" class=\"inputbox\">{$tasklist_comment}</textarea>";
    print "</p>";
    print "<p>";
    print "<input class=\"inputsubmit\" type=\"submit\" value=\"Submit\" />";
    print "</p>";
    print "<input type=\"hidden\" name=\"tasklist_id\" value=\"{$_GET['tasklist_id']}\" />";
    print "<input type=\"hidden\" name=\"action\" value=\"tasklist_change_comment\" />";
    print "</form>";
} elseif ($tasklist_comment != NULL) {
    print "<h2>Comments</h2>";
    print "<p>";
    print $tasklist_comment;