} $formData1 = array('calendarID' => array('type' => 'select_branch_2', 'label' => 'Branch', 'value' => $app["branch"], 'attributes' => array('class' => 'medium')), 'app_user' => array('type' => 'select_user', 'label' => 'User', 'value' => $app["user"], 'attributes' => array('class' => 'medium'), 'options' => array('' => '(unassigned)')), 'app_date' => array('type' => 'datetime', 'label' => 'Date', 'value' => $app["date"], 'attributes' => array('class' => 'medium', 'readonly' => 'readonly')), 'app_time' => array('type' => 'time', 'label' => 'Start Time', 'value' => $app["time"]), 'app_duration' => array('type' => 'select_duration', 'label' => 'Duration', 'value' => $duration, 'attributes' => array('class' => 'medium')), 'notes' => array('type' => 'textarea', 'label' => 'Add ' . $app["type"] . ' Note', 'value' => $app["notes"], 'attributes' => array('class' => 'noteInput'))); if ($expired) { unset($formData1["notes"]); // dont allow new notes to be added $renderReadOnlyValue = 'true'; $renderNotesArrayOptions = array('label' => 'Production Notes', 'layout' => 'readonly'); } else { $renderReadOnlyValue = NULL; $renderNotesArrayOptions = array('label' => 'Production Notes'); } $form->addData($formData1, $_POST); $form->addHtml(renderNotes('appointment', $app_id, $renderNotesArrayOptions)); $form->addHtml($form->addDiv($buttons)); $form->addSeperator(); $form->addHtml(renderVendorTable($vendors, $app_id, $renderReadOnlyValue)); $form->addHtml(renderAttendeeTable($attendees, $app_id, $renderReadOnlyValue)); $form->addHtml(renderDealTable($deals, $app_id, $in_past)); if (!$expired) { $form->addHtml($form->addDiv($form->makeField("button", $formName, "", "Add Properties", array('class' => 'submit', 'onClick' => 'javascript:document.location.href=\'viewing_add.php?stage=viewing_address&app_id=' . $app_id . '&return=' . urlencode($_GET["searchLink"]) . '\';')))); } $form->addHtml("</fieldset>\n"); $form->addHtml('</div>'); break; case "Inspection": $sql = "SELECT\ndea_id,\nCONCAT(pro_addr1,' ',pro_addr2,' ',pro_addr3,' ',pro_postcode) AS pro_addr,\ncli_id,GROUP_CONCAT(CONCAT(cli_fname,' ',cli_sname) SEPARATOR ', ') AS cli_name,\ncon_id,CONCAT(con_fname,' ',con_sname) AS con_name,com_title,\nd2a_id,d2a_ord,d2a_cv,d2a_feedback\nFROM appointment\nLEFT JOIN link_deal_to_appointment ON appointment.app_id = link_deal_to_appointment.d2a_app\nLEFT JOIN deal ON link_deal_to_appointment.d2a_dea = deal.dea_id\nLEFT JOIN property ON deal.dea_prop = property.pro_id\nLEFT JOIN link_client_to_instruction ON deal.dea_id = link_client_to_instruction.dealId\nLEFT JOIN client AS vendor ON link_client_to_instruction.clientId = vendor.cli_id\nLEFT JOIN con2app ON appointment.app_id = con2app.c2a_app\nLEFT JOIN contact ON con2app.c2a_con = contact.con_id\nLEFT JOIN company ON contact.con_company = company.com_id\nWHERE\nlink_deal_to_appointment.d2a_app = {$app_id}\nGROUP BY con_id\nORDER BY link_deal_to_appointment.d2a_ord ASC\n"; $q = $db->query($sql); if (DB::isError($q)) { die("db error: " . $q->getMessage()); } $numRows = $q->numRows();
} $formData1 = array('calendarID' => array('type' => 'select_branch', 'label' => 'Branch', 'value' => $app["branch"], 'attributes' => array('class' => 'medium')), 'app_user' => array('type' => 'select_user', 'label' => 'Negotiator', 'value' => $app["user"], 'attributes' => array('class' => 'medium')), 'app_date' => array('type' => 'datetime', 'label' => 'Date', 'value' => $app["date"], 'attributes' => array('class' => 'medium', 'readonly' => 'readonly')), 'app_time' => array('type' => 'time', 'label' => 'Start Time', 'value' => $app["time"]), 'app_duration' => array('type' => 'select_duration', 'label' => 'Duration', 'value' => $duration, 'attributes' => array('class' => 'medium')), 'app_notes' => array('type' => 'textarea', 'label' => 'Notes', 'value' => $app["notes"], 'attributes' => array('class' => 'wide', 'style' => 'height:50px'))); $form = new Form(); $form->addForm("app_form", "POST", $PHP_SELF); $form->addHtml("<div id=\"standard_form\">\n"); $form->addField("hidden", "action", "", "update"); $form->addField("hidden", "app_id", "", $app_id); $form->addField("hidden", "searchLink", "", urlencode($searchLink)); $form->addHtml("<fieldset>\n"); $form->addHtml('<div class="block-header">' . $app["type"] . '</div>'); $form->addData($formData1, $_POST); $buttons = $form->makeField("submit", $formName, "", "Save Changes", array('class' => 'submit')); $buttons .= $form->makeField("button", "", "", "View in Calendar", array('class' => 'button', 'onClick' => 'javascript:document.location.href=\'calendar.php?app_id=' . $app_id . '&return=' . urlencode($_GET["searchLink"]) . '\';')); $form->addHtml($form->addDiv($buttons)); $form->addSeperator(); $form->addHtml(renderVendorTable($vendors, $app_id)); $form->addHtml(renderAttendeeTable($attendees, $app_id)); $form->addHtml(renderDealTable($deals, $app_id)); $form->addHtml($form->addDiv($form->makeField("button", $formName, "", "Add Properties", array('class' => 'submit', 'onClick' => 'javascript:document.location.href=\'viewing_add.php?stage=viewing_address&app_id=' . $app_id . '&return=' . urlencode($_GET["searchLink"]) . '\';')))); $form->addHtml("</fieldset>\n"); $form->addHtml('</div>'); break; case "Meeting": $formData1 = array('app_subject' => array('type' => 'text', 'label' => 'Subject', 'value' => $app["subject"], 'attributes' => array('class' => 'wide'), 'required' => 2), 'app_notes' => array('type' => 'textarea', 'label' => 'Notes', 'value' => $app["notes"], 'attributes' => array('class' => 'wide', 'style' => 'height:50px')), 'app_user' => array('type' => 'select_user', 'label' => 'User', 'value' => $app["user"], 'attributes' => array('class' => 'medium')), 'app_date' => array('type' => 'datetime', 'label' => 'Date', 'value' => $app["date"], 'attributes' => array('class' => 'medium', 'readonly' => 'readonly')), 'app_time' => array('type' => 'time', 'label' => 'Start Time', 'value' => $app["time"]), 'app_duration' => array('type' => 'select_duration', 'label' => 'Duration', 'value' => $duration, 'attributes' => array('class' => 'medium'))); $form = new Form(); $form->addForm("app_form", "POST", $PHP_SELF); $form->addHtml("<div id=\"standard_form\">\n"); $form->addField("hidden", "action", "", "update"); $form->addField("hidden", "app_id", "", $app_id); $form->addField("hidden", "searchLink", "", urlencode($searchLink)); $form->addHtml("<fieldset>\n");