function showRecords($queryresult) { global $phpbms; ?> <div class="fauxP"> <table border="0" cellpadding="0" cellspacing="0" class="querytable"> <tr> <th nowrap="nowrap" class="queryheader">move</th> <th align="left" nowrap="nowrap" class="queryheader" width="100%">name/field</th> <th align="left" nowrap="nowrap" class="queryheader">ascending</th> <th align="left" nowrap="nowrap" class="queryheader">access</th> <th nowrap="nowrap" class="queryheader"> </th> </tr> <?php $topdisplayorder = -1; $row = 1; while ($therecord = $this->db->fetchArray($queryresult)) { $topdisplayorder = $therecord["displayorder"]; if ($row == 1) { $row = 2; } else { $row = 1; } ?> <tr class="qr<?php echo $row; ?> noselects"> <td nowrap="nowrap"valign="top"> <button type="button" class="graphicButtons buttonUp" onclick="document.location='<?php echo $_SERVER["PHP_SELF"] . "?id=" . $_GET["id"] . "&command=moveup&selid=" . $therecord["id"]; ?> ';"><span>Move Up</span></button> <button type="button" class="graphicButtons buttonDown" onclick="document.location='<?php echo $_SERVER["PHP_SELF"] . "?id=" . $_GET["id"] . "&command=movedown&selid=" . $therecord["id"]; ?> ';"><span>Move Down</span></button> <?php echo $therecord["displayorder"]; ?> </td> <td valign="top"><?php if ($therecord["name"]) { echo "<strong>" . $therecord["name"] . "</strong><br />"; } echo htmlQuotes($therecord["field"]); ?> </td> <td align="center" nowrap="nowrap"valign="top"><?php echo booleanFormat($therecord["ascending"]); ?> </td> <td valign="top"><?php $phpbms->displayRights($therecord["roleid"]); ?> </td> <td nowrap="nowrap"valign="top"> <button id="edit<?php echo $therecord["id"]; ?> " name="doedit" type="button" onclick="document.location='<?php echo $_SERVER["PHP_SELF"] . "?id=" . $_GET["id"] . "&command=edit&selid=" . $therecord["id"]; ?> ';" class="graphicButtons buttonEdit"><span>edit</span></button> <button id="delete<?php echo $therecord["id"]; ?> " name="dodelete" type="button" onclick="document.location='<?php echo $_SERVER["PHP_SELF"] . "?id=" . $_GET["id"] . "&command=delete&selid=" . $therecord["id"]; ?> ';" class="graphicButtons buttonDelete"><span>delete</span></button> </td> </tr> <?php } ?> <tr class="queryfooter"> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> </table></div> <?php }
</td> <td valign="top"> <strong><?php echo $therecord["name"]; ?> </strong><br /> <?php echo htmlQuotes($therecord["column"]); ?> </td> <td nowrap="nowrap"valign="top"><?php echo $therecord["align"]; ?> </td> <td align="center" nowrap="nowrap"valign="top"><?php echo booleanFormat($therecord["wrap"]); ?> </td> <td nowrap="nowrap" valign="top"><?php if ($therecord["size"]) { echo $therecord["size"]; } else { echo " "; } ?> </td> <td valign="top"><?php if ($therecord["format"]) { echo array_search($therecord["format"], $formatArray); } else { echo " ";
function display($clientInfo) { $invoiceEditFile = getAddEditFile($this->db, "tbld:62fe599d-c18f-3674-9e54-b62c2d6b1883"); $noteEditFile = getAddEditFile($this->db, "tbld:a4cdd991-cf0a-916f-1240-49428ea1bdd1"); $clientEditFile = getAddEditFile($this->db, "tbld:6d290174-8b73-e199-fe6c-bcf3d4b61083"); ?> <div class="bodyline" id="theDetails"> <div id="rightSideDiv"> <fieldset> <legend>sales</legend> <ul class="recordCommands"> <li class="firstToolbarItem"><a href="#" class="newRecord" onclick="addEditRecord('new','invoice','<?php echo getAddEditFile($this->db, "tbld:62fe599d-c18f-3674-9e54-b62c2d6b1883", "add"); ?> ')" title="new sales order"><span>new</span></a></li> <li><a href="#" id="invoiceedit" class="editRecordDisabled" onclick="addEditRecord('edit','invoice','<?php echo $invoiceEditFile; ?> ')" title="edit"><span>edit</span></a></li> </ul> <div class="recordContainers"> <div id="salesTable" class="smallQueryTableHolder"> <?php if (!count($clientInfo["invoices"])) { ?> <div class="small"><em>no records</em></div> <?php } else { ?> <table border="0" cellpadding="0" cellspacing="0" class="smallQueryTable"> <tr> <th align="left">ID</th> <th align="left">Type</th> <th align="left">Date</th> <th align="right" width="100%">Total</th> </tr> <?php foreach ($clientInfo["invoices"] as $invoicerecord) { if ($invoicerecord["type"] == "VOID") { $invoicerecord["totalti"] = "-----"; } ?> <tr onclick="selectEdit(this,<?php echo $invoicerecord["id"]; ?> ,'invoice')" ondblclick="selectedInvoice=<?php echo $invoicerecord["id"]; ?> ;addEditRecord('edit','invoice','<?php echo $invoiceEditFile; ?> ')"> <td><?php echo $invoicerecord["id"]; ?> </td> <td><?php echo $invoicerecord["type"]; ?> </td> <td nowrap="nowrap"><?php echo formatFromSQLDate($invoicerecord["thedate"]); ?> </td> <td align="right"><?php echo numberToCurrency($invoicerecord["totalti"]); ?> </td> </tr> <?php } ?> </table><?php } ?> </div> </div> </fieldset> <fieldset> <legend>notes</legend> <ul class="recordCommands"> <li class="firstToolbarItem"><a href="#" title="new note" class="newRecord" onclick="addEditRecord('new','note','<?php echo getAddEditFile($this->db, "tbld:a4cdd991-cf0a-916f-1240-49428ea1bdd1", "add"); ?> ')"><span>new</span></a></li> <li><a href="#" title="edit" id="noteedit" class="editRecordDisabled" onclick="addEditRecord('edit','note','<?php echo $noteEditFile; ?> ')"><span>edit</span></a></li> </ul> <div class="recordContainers"> <div id="notesTable" class="smallQueryTableHolder"> <?php if (!count($clientInfo["notes"])) { ?> <div class="small"><em>no records</em></div> <?php } else { ?> <table border="0" cellpadding="0" cellspacing="0" class="smallQueryTable"> <tr> <th align="left">type</th> <th align="left">category</th> <th align="left" width="100%">title</th> <th align="center">done</th> </tr> <?php foreach ($clientInfo["notes"] as $noterecord) { if (strlen($noterecord["subject"]) > 17) { $noterecord["subject"] = substr($noterecord["subject"], 0, 17) . "..."; } if (strlen($noterecord["category"]) > 17) { $noterecord["category"] = substr($noterecord["category"], 0, 17) . "..."; } ?> <tr onclick="selectEdit(this,<?php echo $noterecord["id"]; ?> ,'note')" ondblclick="selectedNote=<?php echo $noterecord["id"]; ?> ;addEditRecord('edit','note','<?php echo $noteEditFile; ?> ')"> <td><?php echo $noterecord["type"]; ?> </td> <td><?php echo $noterecord["category"]; ?> </td> <td><?php echo $noterecord["subject"]; ?> </td> <td align="center"><?php echo booleanFormat($noterecord["completed"]); ?> </td> </tr> <?php } ?> </table><?php } ?> </div> </div> </fieldset> </div> <div id="leftSideDiv"> <fieldset id="crTile" class="fs<?php echo $clientInfo["type"]; ?> "> <h1> <input type="hidden" id="theid" value="<?php echo $clientInfo["id"]; ?> " /> <input type="hidden" id="theuuid" value="<?php echo $clientInfo["uuid"]; ?> " /> <?php if ($clientInfo["company"]) { echo htmlQuotes($clientInfo["company"]); } else { echo htmlQuotes($clientInfo["firstname"] . " " . $clientInfo["lastname"]); } ?> <button id="viewClientButton" type="button" title="view client" class="graphicButtons buttonInfo" onclick="addEditRecord('edit','client','<?php echo $clientEditFile; ?> ')"><span>view client</span></button></h1> <?php if ($clientInfo["company"] && $clientInfo["firstname"] && $clientInfo["lastname"]) { ?> <p id="crName"><?php echo htmlQuotes($clientInfo["firstname"]); ?> <?php echo htmlQuotes($clientInfo["lastname"]); ?> </p><?php } //endif ?> <?php $location = ""; $location .= htmlQuotes($clientInfo["address1"]); if ($clientInfo["address2"]) { $location .= "<br />" . htmlQuotes($clientInfo["address2"]); } if ($clientInfo["city"] || $clientInfo["state"] || $clientInfo["postalcode"]) { $location .= "<br/>" . htmlQuotes($clientInfo["city"]); if ($clientInfo["city"] && $clientInfo["state"]) { $location .= ", "; } $location .= htmlQuotes($clientInfo["state"]); $location .= " " . htmlQuotes($clientInfo["postalcode"]); } //endif if ($clientInfo["country"]) { $location .= "<br />" . htmlQuotes($clientInfo["country"]); } if ($location == "") { $location = "unspecified location"; } ?> <p id="crLocation"><?php echo $location; ?> </p> </fieldset> <fieldset> <legend>Contact</legend> <?php if ($clientInfo["workphone"] || $clientInfo["homephone"] || $clientInfo["mobilephone"] || $clientInfo["otherphone"] || $clientInfo["fax"]) { ?> <p class="RDNames">phone</p> <div class="fauxP RDData"> <ul> <?php if ($clientInfo["workphone"]) { ?> <li><?php echo $clientInfo["workphone"]; ?> (w)</li> <?php } ?> <?php if ($clientInfo["homephone"]) { ?> <li><?php echo $clientInfo["homephone"]; ?> (h)</li> <?php } ?> <?php if ($clientInfo["mobilephone"]) { ?> <li><?php echo $clientInfo["mobilephone"]; ?> (m)</li> <?php } ?> <?php if ($clientInfo["otherphone"]) { ?> <li><?php echo $clientInfo["otherphone"]; ?> (o)</li> <?php } ?> <?php if ($clientInfo["fax"]) { ?> <li><?php echo $clientInfo["fax"]; ?> (fax)</li> <?php } ?> </ul> </div> <?php } ?> <?php if ($clientInfo["email"]) { ?> <p class="RDNames">e-mail</p> <p class="RDData"> <button type="button" class="graphicButtons buttonEmail" onclick="document.location='mailto:<?php echo $clientInfo["email"]; ?> '"><span>send email</span></button> <a href="mailto:<?php echo $clientInfo["email"]; ?> "><?php echo htmlQuotes($clientInfo["email"]); ?> </a> </p> <?php } ?> <?php if ($clientInfo["webaddress"]) { ?> <p class="RDNames">web site</p> <p class="RDData"> <button type="button" class="graphicButtons buttonWWW" onclick="window.open('<?php echo $clientInfo["webaddress"]; ?> ')"><span>visit site</span></button> <a href="<?php echo $clientInfo["webaddress"]; ?> " target="_blank"><?php echo htmlQuotes($clientInfo["webaddress"]); ?> </a> </p> <?php } ?> </fieldset> <fieldset> <legend>Details</legend> <?php if ($clientInfo["becameclient"]) { ?> <p class="RDNames">became client</p> <p class="RDData"> <?php echo formatVariable($clientInfo["becameclient"], "date"); ?> </p> <?php } ?> <?php if ($clientInfo["category"]) { ?> <p class="RDNames">category</p> <p class="RDData"> <?php echo htmlQuotes($clientInfo["category"]); ?> </p> <?php } ?> <?php if ($clientInfo["leadsource"]) { ?> <p class="RDNames">lead source</p> <p class="RDData"> <?php echo htmlQuotes($clientInfo["leadsource"]); ?> </p> <?php } ?> <?php if ($clientInfo["salesmanagerid"]) { global $phpbms; ?> <p class="RDNames">sales person</p> <p class="RDData"> <?php echo htmlQuotes($phpbms->getUserName($clientInfo["salesmanagerid"])); ?> </p> <?php } ?> </fieldset> <?php if ($clientInfo["comments"]) { ?> <fieldset> <legend>memo</legend> <p> <?php echo htmlQuotes($clientInfo["comments"]); ?> </p> </fieldset> <?php } ?> </div> <p id="theclear"> </p> </div> <?php }
function formatVariable($value, $format = NULL) { switch ($format) { case "real": $value = number_format($value, 2); break; case "currency": $value = htmlQuotes(numberToCurrency($value)); break; case "boolean": $value = booleanFormat($value); break; case "date": $value = formatFromSQLDate($value); break; case "time": $value = formatFromSQLTime($value); break; case "datetime": $value = formatFromSQLDatetime($value); break; case "filelink": $value = "<button class=\"graphicButtons buttonDownload\" type=\"button\" onclick=\"document.location='" . APP_PATH . "servefile.php?i=" . $value . "'\"><span>download</span></button>"; //$value="<a href=\"".APP_PATH."servefile.php?i=".$value."\" style=\"display:block;\"><img src=\"".APP_PATH."common/stylesheet/".STYLESHEET."/image/button-download.png\" align=\"middle\" alt=\"view\" width=\"16\" height=\"16\" border=\"0\" /></a>"; break; case "invoice": if ($value > 0 and $value != 9999999) { $value = "<a href=\"" . APP_PATH . "modules/bms/invoices_addedit.php?id={$value}\">{$value}</a>"; } break; case "client": $value = "<a href=\"" . APP_PATH . "modules/bms/clients_addedit.php?id={$value}\">{$value}</a>"; break; case "noencoding": $value = $value; break; case "bbcode": $value = htmlQuotes($value); // This list needs to be expanded $bbcodelist["[b]"] = "<strong>"; $bbcodelist["[/b]"] = "</strong>"; $bbcodelist["[br]"] = "<br />"; $bbcodelist["[space]"] = " "; foreach ($bbcodelist as $bbcode => $translation) { $value = str_replace($bbcode, $translation, $value); } break; default: $value = htmlQuotes($value); } return $value; }