function future() { $sql = "SELECT * FROM cubit.today WHERE date>now()"; $today_rslt = db_exec($sql) or errDie("Unable to retrieve today."); $prev_out = ""; $future_out = ""; while ($today_data = pg_fetch_array($today_rslt)) { if (!in_team($today_data["team_id"], USER_ID)) { continue; } $datetime = "{$today_data['date']} / "; if (!empty($today_data["time"])) { $datetime .= $today_data["time"]; } else { $datetime .= "Entire Day"; } // Retrieve the section $sql = "SELECT * FROM cubit.today_sections WHERE id='{$today_data['section_id']}'"; $section_rslt = db_exec($sql) or errDie("Unable to retrieve section."); $section_data = pg_fetch_array($section_rslt); $future_out .= "\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td>{$datetime}</td>\n\t\t\t\t<td><a href='javascript:popupOpen(\"{$section_data['link']}\")'>{$section_data['name']}</a></td>\n\t\t\t\t<td><a href='javascript:popupOpen(\"{$today_data['link']}\")'>{$today_data['title']}</a></td>\n\t\t\t\t<td>{$today_data['info']}</td>\n\t\t\t\t<td align='center'>\n\t\t\t\t\t<input type='checkbox' name='rem[{$today_data['id']}]' \n\t\t\t\t\tvalue='{$today_data['id']}' onchange='javascript:document.form.submit()' />\n\t\t\t\t</td>\n\t\t\t</tr>"; } if (empty($future_out)) { $future_out = "\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td colspan='5'><li>No items found for today</li></td>\n\t\t\t</tr>"; } $OUTPUT = "\n\t\t<h3>Future Action Display</h3>\n\t\t<form method='post' action='" . SELF . "' name='form'>\n\t\t\t<input type='hidden' name='key' value='remove' />\n\t\t\t<a href='" . SELF . "' style='font-size:12pt; font-weight: bold'>Today/Previous Action Dates</a>\n\t\t\t<p></p>\n\t\t<table cellpadding='5' cellspacing='0' class='shtable'>\n\t\t\t<tr>\n\t\t\t\t<th>Date / Time</th>\n\t\t\t\t<th>Section</th>\n\t\t\t\t<th>Title</th>\n\t\t\t\t<th>Info</th>\n\t\t\t\t<th>Remove</th>\n\t\t\t</tr>\n\t\t\t{$future_out}\n\t\t</table><br>" . mkQuickLinks(ql("../crmsystem/leads_list.php", "Return To View Leads")); return $OUTPUT; }
function write() { extract($_REQUEST); if ($page_option == "Edit") { $sql = "UPDATE cubit.todo_main SET title='{$title}', team_id='{$team_id}'\n\t\tWHERE id='{$id}' AND user_id='" . USER_ID . "'"; } else { $sql = "INSERT INTO cubit.todo_main (title, user_id, team_id)\n\t\tVALUES ('{$title}', '" . USER_ID . "', '{$team_id}')"; } db_exec($sql) or errDie("Unable to save main todo."); if (frmupdate_passon()) { $newlist = new dbSelect("todo_main", "cubit"); $newlist->run(); // are we an admin? $sql = "SELECT admin FROM cubit.users WHERE userid='" . USER_ID . "'"; $admin_rslt = db_exec($sql) or errDie("Unable to check for admin."); $admin = pg_fetch_result($admin_rslt, 0); $a = array(); if ($newlist->num_rows() > 0) { $a[0] = "[None]"; while ($row = $newlist->fetch_array()) { if (in_team(USER_ID, $row["team_id"])) { $sql = "SELECT * FROM cubit.todo_main WHERE id='{$row['id']}'"; $tm_rslt = db_exec($sql) or errDie("Unable to retrieve todo."); $count = pg_num_rows($tm_rslt); $a[$row["id"]] = "{$row['title']} ({$count})"; } else { continue; } } } $js = frmupdate_exec(array($a), true); } else { $js = ""; } $OUTPUT = "{$js}\n\t<h3>{$page_option} Main Todo</h3>\n\t<table cellpadding='2' cellspacing='0' class='shtable'>\n\t\t<tr>\n\t\t\t<th>Write</th>\n\t\t</tr>\n\t\t<tr class='odd'><td>Successfully saved the main todo.</td></tr>\n\t</table>"; return $OUTPUT; }
function display() { extract($_REQUEST); $fields = array(); $fields["search"] = ""; $fields["disp_inactive"] = ""; $fields["offset"] = 0; extract($fields, EXTR_SKIP); $counter1 = 0; $counter2 = 0; $counter3 = 0; if (!empty($disp_inactive)) { $sql_status = "(status='active' OR status='inactive')"; } else { $sql_status = "status='active'"; } //GET NORMAL CRM DOCUMENTS ... if (!empty($search)) { $sql = "SELECT * FROM cubit.documents WHERE {$sql_status} AND (docid ILIKE '%{$search}%'\n\t\t\t\tOR title ILIKE '%{$search}%' OR location ILIKE '%{$search}%')"; } else { $sql = "SELECT * FROM cubit.documents WHERE {$sql_status}"; } $osRslt = db_exec($sql) or errDie("Unable to retrieve documents."); $offset_prev = $offset - 20; $offset_next = $offset + 20; if ($offset_prev < 0) { $prev = ""; } else { $prev = "<a href='?search={$search}&offset={$offset_prev}&disp_inactive={$disp_inactive}'>« Previous</a>"; } $numcount1 = pg_numrows($osRslt); if (!empty($search)) { $sql = "\n\t\t\tSELECT * \n\t\t\tFROM cubit.documents \n\t\t\tWHERE {$sql_status} AND (docid ILIKE '%{$search}%' OR title ILIKE '%{$search}%' OR location ILIKE '%{$search}%')\n\t\t\tLIMIT 20 OFFSET {$offset}"; } else { $sql = "SELECT * FROM cubit.documents WHERE {$sql_status} LIMIT 20 OFFSET {$offset}"; } $doc_rslt = db_exec($sql) or errDie("Unable to retrieve documents."); $doc_out = ""; while ($doc_data = pg_fetch_array($doc_rslt)) { if (!in_team($doc_data["team_id"], USER_ID)) { continue; } if (!$doc_data["wordproc"]) { $doc_edit = "document_save.php?id={$doc_data['docid']}&mode=edit"; } else { $doc_edit = "word_proc.php?id={$doc_data['docid']}"; } $doc_out .= "\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td>{$doc_data['title']}</td>\n\t\t\t\t<td>{$doc_data['location']}</td>\n\t\t\t\t<td><a href='document_det.php?id={$doc_data['docid']}'>Details</a></td>\n\t\t\t\t<td><a href='{$doc_edit}'>Edit</a></td>\n\t\t\t\t<td><a href='document_rem.php?id={$doc_data['docid']}'>Remove</a></td>\n\t\t\t\t<td><a href='document_transmit.php?id={$doc_data['docid']}'>Transmit</a></td>\n\t\t\t\t<td><a href='document_movement.php?id={$doc_data['docid']}'>Document Movement</a></td>\n\t\t\t</tr>"; $counter1++; } if (empty($doc_out)) { $doc_out = "\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td colspan='10'><li>No results found</li></td>\n\t\t\t</tr>"; } //GET CUSTOMER DOCUMENTS ... $sql = "SELECT * FROM crm.customer_docs LIMIT 20 OFFSET {$offset}"; $cd_rslt = db_exec($sql) or errDie("Unable to retrieve customer docs."); $numcount2 = pg_numrows($cd_rslt); $cdoc_out = ""; while ($cd_data = pg_fetch_array($cd_rslt)) { // Retrieve customer $sql = "SELECT * FROM cubit.customers WHERE cusnum='{$cd_data['cusnum']}'"; $cust_rslt = db_exec($sql) or errDie("Unable to retrieve customer."); $cust_data = pg_fetch_array($cust_rslt); if (!in_team($cust_data["team_id"], USER_ID)) { continue; } $cdoc_out .= "\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td>{$cd_data['filename']} ({$cd_data['real_filename']})</td>\n\t\t\t\t<td>{$cust_data['surname']}</td>\n\t\t\t\t<td><a href='../cust_doc_get.php?id={$cd_data['id']}&tmp=1&table=customer_docs'>View</a></td>\n\t\t\t\t<td><a href='doc-cust-rem.php?docid={$cd_data['id']}'>Remove</a></td>\n\t\t\t\t<td colspan='5'> </td>\n\t\t\t</tr>"; $counter2++; } if (empty($cdoc_out)) { $cdoc_out = "\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td colspan='7'><li>No results found</li></td>\n\t\t\t</tr>"; } db_conn('crm'); //GET SUPPLIER DOCUMENTS ... $sql = "SELECT * FROM crm.supplier_docs LIMIT 20 OFFSET {$offset}"; $sd_rslt = db_exec($sql) or errDie("Unable to retrieve customer docs."); $numcount3 = pg_numrows($sd_rslt); $sdoc_out = ""; while ($sd_data = pg_fetch_array($sd_rslt)) { // Retrieve customer $sql = "SELECT * FROM cubit.suppliers WHERE supid='{$sd_data['supid']}'"; $cust_rslt = db_exec($sql) or errDie("Unable to retrieve supplier."); $supp_data = pg_fetch_array($cust_rslt); if (!in_team($supp_data["team_id"], USER_ID)) { continue; } if (strlen($sd_data['filename']) > 0) { $showdoc = "{$sd_data['filename']}"; } elseif (strlen($sd_data['real_filename']) > 0) { $showdoc = "{$sd_data['real_filename']}"; } else { $showdoc = "File" . $sd_data["id"]; } $sdoc_out .= "\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td>{$showdoc} ({$sd_data['real_filename']})</td>\n\t\t\t\t<td>{$supp_data['supname']}</td>\n\t\t\t\t<td><a href='../supp_doc_get.php?id={$sd_data['id']}'>View</a></td>\n\t\t\t\t<td><a href='doc-supp-rem.php?docid={$sd_data['id']}'>Remove</a></td>\n\t\t\t\t<td colspan='5'> </td>\n\t\t\t</tr>"; $counter3++; } if (empty($sdoc_out)) { $sdoc_out = "\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td colspan='7'><li>No results found</li></td>\n\t\t\t</tr>"; } if ($counter1 < 20 and $counter2 < 20 and $counter3 < 20) { $showbuttons = ""; } else { } if ($offset_next > $numcount1 and $offset_next > $numcount2 and $offset_next > $numcount3) { $next = ""; } else { $next = "<a href='?search={$search}&offset={$offset_next}&disp_inactive={$disp_inactive}'>Next »</a>"; } $OUTPUT = "\n\t\t<center>\n\t\t<h3>View Documents</h3>\n\t\t<form method='post' action='" . SELF . "' name='form'>\n\t\t<table cellpadding='2' cellspacing='0' class='shtable'>\n\t\t\t<tr>\n\t\t\t\t<th colspan='2'>Search</th>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td><input type='text' name='search' value='{$search}' /></td>\n\t\t\t\t<td><input type='submit' value='Search' /></td>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td colspan='2'>\n\t\t\t\t\t<input type='checkbox' name='disp_inactive' value='checked'\n\t\t\t\t\t{$disp_inactive} onchange='javascript:document.form.submit()'>\n\t\t\t\t\tDisplay Inactive\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t</table>\n\t\t</form>\n\t\t<table cellpadding='2' cellspacing='0' class='shtable'>\n\t\t\t<tr>\n\t\t\t\t<th>Title</th>\n\t\t\t\t<th>Location</th>\n\t\t\t\t<th colspan='5'>Options</th>\n\t\t\t</tr>\n\t\t\t{$doc_out}\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td colspan='4'>{$prev}</td>\n\t\t\t\t<td colspan='4' align='right'>{$next}</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<th colspan='7'>Customer Documents</th>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<th>Title</th>\n\t\t\t\t<th>Customer</th>\n\t\t\t\t<th colspan='5'>Options</th>\n\t\t\t</tr>\n\t\t\t{$cdoc_out}\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td colspan='4'>{$prev}</td>\n\t\t\t\t<td colspan='4' align='right'>{$next}</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<th colspan='7'>Supplier Documents</th>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<th>Title</th>\n\t\t\t\t<th>Supplier</th>\n\t\t\t\t<th colspan='5'>Options</th>\n\t\t\t</tr>\n\t\t\t{$sdoc_out}\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td colspan='4'>{$prev}</td>\n\t\t\t\t<td colspan='4' align='right'>{$next}</td>\n\t\t\t</tr>\n\t\t\t{$showbuttons}\n\t\t</table>\n\t\t</center>"; return $OUTPUT; }
function listContacts() { global $_GET, $_SESSION; global $mail_sender; extract($_GET); $OUTPUT = ""; // store unset variables so different commands remember previous values // this way u can search, and go through contacts, suppliers and customers with the same search if (!isset($key)) { $key = ""; } if (!isset($fields)) { $fields = ""; } if (!isset($filter)) { $filter = ""; } if (!isset($offset)) { $offset = 0; } if (!isset($action)) { $action = "viewcon"; } $offset += 0; $pass_filter = $filter; // stores the filter so it can be passed on cleanly // format the filter if (!isset($filter) || $filter == 'all') { $filter = "()"; } else { if (isset($key) && $key == "search") { $filter = "(" . str_replace(" ", "|", $filter) . ")"; } else { $filter = "^({$filter})"; } } // create the fields array if (!isset($fields) || !isset($key) || $key != "search") { $fields_look[] = "surname"; } else { $fields_look = explode(",", $fields); } // set the $ref var if (!isset($ref)) { $ref = "contacts"; } // select the type of contact to view if ($ref == "suppliers") { $pgref = "ref='Supplier'"; } elseif ($ref == "customers") { $pgref = "ref='Customer'"; } else { $pgref = "ref <> 'Supplier' AND ref <> 'Customer'"; } // create the actual conditions $sql_filters = array(); foreach ($fields_look as $arr => $arrval) { $sql_filters[] = "{$arrval} ~* '{$filter}'"; } $sql_filters = "(" . implode(" OR ", $sql_filters) . ")"; // count the results first $sql = "SELECT COUNT(id) FROM cons\r\n\t\tWHERE {$pgref}\r\n\t\t\tAND {$sql_filters}\r\n\t\t\tAND ( (\r\n\t\t\t\tassigned_to = '{$_SESSION['USER_NAME']}'\r\n\t\t\t\tAND con = 'Yes'\r\n\t\t\t) OR (\r\n\t\t\t\tcon = 'No'\r\n\t\t\t) )"; db_conn("cubit"); $rslt = db_exec($sql); $result_count = pg_fetch_result($rslt, 0, 0); // execute the query $sql = "SELECT * FROM cons\r\n\t\tWHERE {$pgref}\r\n\t\t\tAND {$sql_filters}\r\n\t\t\tAND ( (\r\n\t\t\t\tassigned_to = '{$_SESSION['USER_NAME']}'\r\n\t\t\t\tAND con = 'Yes'\r\n\t\t\t) OR (\r\n\t\t\t\tcon = 'No'\r\n\t\t\t) ) ORDER BY surname LIMIT " . CONTACT_DISPLAY_AMOUNT . " OFFSET {$offset}"; db_conn("cubit"); $rslt = db_exec($sql); // temp vars $cellcolor[0] = TMPL_tblDataColor1; $cellcolor[1] = TMPL_tblDataColor2; $cellcolor[2] = TMPL_tblDataColorOver; // generate the contacts list from Cubit results $contact_data = ""; $i = 0; while ($row = pg_fetch_array($rslt)) { if (!in_team($row["team_id"], USER_ID)) { continue; } // create the event data for the row $rowname = "conrow_{$row['id']}"; $mmove_events = "\r\n\t\t\tonMouseOver = 'javascript: changeContactRowColor(\"{$rowname}\",\"{$cellcolor['2']}\");'\r\n\t\t\tonMouseOut = 'javascript: changeContactRowColor(\"{$rowname}\",\"{$cellcolor[$i]}\");'"; // create the row with it's information $fullname = ""; if (!empty($row["name"])) { $fullname .= "{$row['name']} "; } $fullname .= "{$row['surname']}"; if ($action == "viewcon") { $href_action = "javascript: viewContact(\"{$row['id']}\")"; } else { if ($action == "reportsto") { $href_action = "javascript: updateReportsTo(\"{$row['id']}\", \"{$fullname}\")"; } } $contact_data .= "\r\n\t\t\t<tr id='{$rowname}' {$mmove_events} class='even'>\r\n\t\t\t\t<td><a href='{$href_action}'>{$fullname}</a></td>"; $contact_data .= "\r\n\t\t\t\t<td>{$row['title']}</td>\r\n\t\t\t\t<td>{$row['accountname']}</td>\r\n\t\t\t\t<td>{$row['tell']}</td>\r\n\t\t\t\t<td align=center>\r\n\t\t\t\t\t<a href='{$mail_sender}{$row['email']}' target=rightframe>\r\n\t\t\t\t\t\t{$row['email']}\r\n\t\t\t\t\t</a>\r\n\t\t\t\t</td>\r\n\t\t\t</tr>"; $i = ++$i % 2; // select the color of the next row (this way is neat little formula i just thought up) } // if no data has been found, make a default cell telling this if ($contact_data == "") { $contact_data = "<tr class='odd'><td colspan=6>No contacts found</td></tr>"; } // the select filter list $flist = "<font size=2><b>"; $flist .= "<a class=nav href='list_cons.php?ref={$ref}&action={$action}&filter=0"; for ($i = ord('1'); $i <= ord('9'); $i++) { $flist .= "|" . chr($i); } $flist .= "'>#</a> "; for ($i = ord('A'); $i <= ord('Z'); $i++) { $flist .= "<a class=nav href='list_cons.php?ref={$ref}&action={$action}&filter=" . chr($i) . "|" . chr($i + 32) . "'>" . chr($i) . "</a> "; } $flist .= "<a class=nav href='list_cons.php?ref={$ref}&action={$action}'>All</a></b></font>"; // set which is selected under the contact type selection box $refselected_contacts = ""; $refselected_suppliers = ""; $refselected_customers = ""; if ($ref == "suppliers") { $refselected_suppliers = "selected"; } else { if ($ref == "customers") { $refselected_customers = "selected"; } else { $refselected_contacts = "selected"; } } // create the output $OUTPUT = "\r\n\t<script>\r\n\t\t// contacts scripts\r\n\t\tfunction changeContactRowColor(obj, tocolor) {\r\n\t\t\tgetObjectById(obj).style.background=tocolor;\r\n\t\t}\r\n\r\n\t\tfunction viewContact(id) {\r\n\t\t\tpopupOpen('view_con.php?id=' + id,'contact_popup','scrollbars=yes,width=660,height=450');\r\n\t\t}\r\n\r\n\t\tfunction updateReportsTo(id, name) {\r\n\t\t\twindow.opener.document.frm_con.reports_to.value=name;\r\n\t\t\twindow.opener.document.frm_con.reports_to_id.value=id;\r\n\t\t\twindow.close();\r\n\t\t}\r\n\t</script>\r\n\t<table width='95%' border=0 cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "'>\r\n\t<tr>\r\n\t\t<td align=left nowrap><font size=2><b>"; if ($action == "viewcon") { $OUTPUT .= "<a class=nav href=\"new_con.php\">New Main Contact</a></b></font>"; } $OUTPUT .= "\r\n\t\t</td>\r\n\t\t<td align=right nowrap>\r\n\t\t\t<form method=post action='" . SELF . "'>\r\n\t\t\t\t<input type=hidden name=key value=search>\r\n\t\t\t\t<input type=hidden name=fields value='name,surname,comp,email,padd,hadd'>\r\n\t\t\t\t<input type=hidden name=ref value='{$ref}'>\r\n\t\t\t\t<input type=hidden name=action value='{$action}'>\r\n\t\t\t\t<input type=text name=filter value=''>\r\n\t\t\t\t<input type=submit value=search>\r\n\t\t\t</form>\r\n\t\t</td>\r\n\t</tr>\r\n\t<tr>\r\n\t\t<td width='80%' align=center nowrap>\r\n\t\t\t{$flist}\r\n\t\t</td>\r\n\t\t<td width='20%' align=right nowrap>\r\n\t\t\t<form method=post action='" . SELF . "'>\r\n\t\t\t<input type=hidden name=filter value='{$pass_filter}'>\r\n\t\t\t<input type=hidden name=key value='{$key}'>\r\n\t\t\t<input type=hidden name=fields value='{$fields}'>\r\n\t\t\t<input type=hidden name=action value='{$action}'>\r\n\t\t\t<select name=ref onChange='form.submit()'>\r\n\t\t\t\t<option value='contacts' {$refselected_contacts}>Contacts</option>\r\n\t\t\t\t<option value='customers' {$refselected_customers}>Customers</option>\r\n\t\t\t\t<option value='suppliers' {$refselected_suppliers}>Suppliers</option>\r\n\t\t\t</select>\r\n\t\t\t</form>\r\n\t\t</td>\r\n\t</tr>\r\n\t<tr>\r\n\t\t<td width='100%' colspan=2>\r\n\t\t<table cellpadding='2' cellspacing='0' class='shtable' width='100%'>"; // previous images if ($offset < CONTACT_DISPLAY_AMOUNT) { $go_previous = "\r\n\t\t\t<font color='#9C999C'>\r\n\t\t\t<img src='../crmsystem/go_start_off.gif'> Start\r\n\t\t\t<img src='../crmsystem/go_previous_off.gif'> Previous\r\n\t\t\t</font>"; } else { $go_previous = "\r\n\t\t\t<a href='" . SELF . "?ref={$ref}&action={$action}&key={$key}&fields={$fields}&filter={$pass_filter}&offset=0'\r\n\t\t\t\t\tid=contacts_nextprevious>\r\n\t\t\t\t<img border=0 src='crmsystem/go_start.gif'> Start\r\n\t\t\t</a>\r\n\t\t\t<a href='" . SELF . "?ref={$ref}&action={$action}&key={$key}&fields={$fields}&filter={$pass_filter}&offset=" . ($offset - CONTACT_DISPLAY_AMOUNT) . "'\r\n\t\t\t\t\tid=contacts_nextprevious>\r\n\t\t\t\t<img border=0 src='crmsystem/go_previous.gif'> Previous\r\n\t\t\t</a>"; } if ($offset + CONTACT_DISPLAY_AMOUNT >= $result_count) { $go_next = "\r\n\t\t\t<font color='#9C999C'>\r\n\t\t\tNext <img src='../crmsystem/go_next_off.gif'>\r\n\t\t\tEnd <img src='../crmsystem/go_end_off.gif'>\r\n\t\t\t</font>"; } else { $go_next = "\r\n\t\t\t<a href='" . SELF . "?ref={$ref}&action={$action}&key={$key}&fields={$fields}&filter={$pass_filter}&offset=" . ($offset + CONTACT_DISPLAY_AMOUNT) . "'\r\n\t\t\t\t\tid=contacts_nextprevious>\r\n\t\t\t\tNext <img border=0 src='crmsystem/go_next.gif'>\r\n\t\t\t</a>\r\n\t\t\t<a href='" . SELF . "?ref={$ref}&action={$action}&key={$key}&fields={$fields}&filter={$pass_filter}&offset=" . ($result_count - CONTACT_DISPLAY_AMOUNT) . "'\r\n\t\t\t\t\tid=contacts_nextprevious>\r\n\t\t\t\tEnd <img border=0 src='crmsystem/go_end.gif'>\r\n\t\t\t</a>"; } $OUTPUT .= "<tr>\r\n\t\t\t<td colspan=5 bgcolor='#eeeeee' height=15 align=right>\r\n\t\t\t\t{$go_previous} \r\n\t\t\t\t(" . ($offset + 1) . " - " . ($offset + CONTACT_DISPLAY_AMOUNT <= $result_count ? $offset + CONTACT_DISPLAY_AMOUNT : $result_count) . " of {$result_count})\r\n\t\t\t\t {$go_next}\r\n\t\t\t</td>\r\n\t\t</tr>\r\n\t\t<tr>"; // table heading style $head_s = "background='crmsystem/header_bg2.gif' height=20 align=left"; $OUTPUT .= "\t<th>Company/Name</th>\r\n\t\t<th>Title</th>\r\n\t\t<th>Account</th>\r\n\t\t<th>Tel</th>\r\n\t\t<th>Email</th>"; // finish the output $OUTPUT .= "\t\t</tr>\r\n\t\t\t\t{$contact_data}\r\n\t\t\t</table>\r\n\t\t</td>\r\n\t</tr>\r\n\t</table>"; return $OUTPUT; }