function build_main_html()
 {
     global $db, $messageStack, $currencies;
     $content = array();
     $content['thead'] = array('value' => array(TEXT_DESCRIPTION, TEXT_GL_ACCOUNT, TEXT_BANK_ACCOUNT, TEXT_ACTION), 'params' => 'width="100%" cellspacing="0" cellpadding="1"');
     $result = $db->Execute("select * from " . $this->db_table);
     $rowCnt = 0;
     while (!$result->EOF) {
         $actions = '';
         if ($this->security_id > 1) {
             $actions .= html_icon('actions/edit-find-replace.png', TEXT_EDIT, 'small', 'onclick="loadPopUp(\'' . $this->code . '_edit\', ' . $result->fields['kt_id'] . ')"') . chr(10);
         }
         if ($this->security_id > 3) {
             $actions .= html_icon('emblems/emblem-unreadable.png', TEXT_DELETE, 'small', 'onclick="if (confirm(\'' . SETUP_TILL_DELETE_INTRO . '\')) subjectDelete(\'' . $this->code . '\', ' . $result->fields['kt_id'] . ')"') . chr(10);
         }
         $content['tbody'][$rowCnt] = array(array('value' => htmlspecialchars($result->fields['description']), 'params' => 'style="cursor:pointer" onclick="loadPopUp(\'' . $this->code . '_edit\',\'' . $result->fields['kt_id'] . '\')"'), array('value' => gen_get_type_description(TABLE_CHART_OF_ACCOUNTS, $result->fields['gl_acct_id']), 'params' => 'style="cursor:pointer" onclick="loadPopUp(\'' . $this->code . '_edit\',\'' . $result->fields['kt_id'] . '\')"'), array('value' => $result->fields['bank_account'], 'params' => 'style="cursor:pointer" onclick="loadPopUp(\'' . $this->code . '_edit\',\'' . $result->fields['kt_id'] . '\')"'), array('value' => $actions, 'params' => 'align="right"'));
         $result->MoveNext();
         $rowCnt++;
     }
     return html_datatable('' . $this->code . '_table', $content);
 }
 function build_main_html()
 {
     global $db, $messageStack;
     // Build heading bar
     $output = '<table border="0" width="100%" cellspacing="0" cellpadding="1">' . chr(10);
     $output .= '  <tr class="dataTableHeadingRow" valign="top">' . chr(10);
     $heading_array = array('description_short' => SETUP_TAX_DESC_SHORT, 'account_id' => SETUP_TAX_GL_ACCT, 'tax_rate' => SETUP_TAX_RATE);
     $result = html_heading_bar($heading_array, $_GET['list_order']);
     $output .= $result['html_code'];
     $disp_order = $result['disp_order'];
     $output .= '  </tr>' . chr(10);
     // Build field data
     $query_raw = "select tax_auth_id, description_short, account_id, tax_rate \r\n\tfrom " . $this->db_table . " where type = '" . $this->type . "' order by {$disp_order}";
     $page_split = new splitPageResults($_GET['page'], MAX_DISPLAY_SEARCH_RESULTS, $query_raw, $query_numrows);
     $result = $db->Execute($query_raw);
     while (!$result->EOF) {
         $output .= '  <tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)">' . chr(10);
         $output .= '    <td class="dataTableContent" onclick="loadPopUp(\'edit\', ' . $result->fields['tax_auth_id'] . ')">' . htmlspecialchars($result->fields['description_short']) . '</td>' . chr(10);
         $output .= '    <td class="dataTableContent" onclick="loadPopUp(\'edit\', ' . $result->fields['tax_auth_id'] . ')">' . gen_get_type_description(TABLE_CHART_OF_ACCOUNTS, $result->fields['account_id']) . '</td>' . chr(10);
         $output .= '    <td class="dataTableContent" onclick="loadPopUp(\'edit\', ' . $result->fields['tax_auth_id'] . ')">' . $result->fields['tax_rate'] . '</td>' . chr(10);
         $output .= '    <td class="dataTableContent" align="right">' . chr(10);
         if ($this->security_id > 1) {
             $output .= html_icon('actions/edit-find-replace.png', TEXT_EDIT, 'small', 'onclick="loadPopUp(\'edit\', ' . $result->fields['tax_auth_id'] . ')"') . chr(10);
         }
         if ($this->security_id > 3) {
             $output .= html_icon('emblems/emblem-unreadable.png', TEXT_DELETE, 'small', 'onclick="if (confirm(\'' . SETUP_TAX_AUTH_DELETE_INTRO . '\')) submitSeq(' . $result->fields['tax_auth_id'] . ', \'delete\')"') . chr(10);
         }
         $output .= '    </td>' . chr(10);
         $output .= '  </tr>' . chr(10);
         $result->MoveNext();
     }
     $output .= '</table>' . chr(10);
     $output .= '<div class="page_count_right">' . $page_split->display_links($query_numrows, MAX_DISPLAY_SEARCH_RESULTS, MAX_DISPLAY_PAGE_LINKS, $_GET['page']) . '</div>' . chr(10);
     $output .= '<div class="page_count">' . $page_split->display_count($query_numrows, MAX_DISPLAY_SEARCH_RESULTS, $_GET['page'], SETUP_DISPLAY_NUMBER_OF_TAX_AUTH) . '</div>' . chr(10);
     return $output;
 }
 function Update()
 {
     global $db;
     $admin_id = $_SESSION['admin_id'];
     $report_id = db_prepare_input($_POST['report_id']);
     $description = gen_get_type_description(TABLE_REPORTS, $report_id, false);
     $remove_id = db_prepare_input($_POST[$this->module_id . '_rId']);
     $page_id = $_GET['module'] ? $_GET['module'] : 'index';
     // do nothing if no title or url entered
     if (!$remove_id && $report_id == '') {
         return;
     }
     // fetch the current params
     $result = $db->Execute("select params from " . TABLE_USERS_PROFILES . "\r\n\t\t\twhere page_id = '" . $page_id . "' and user_id = " . $admin_id . " and module_id = '" . $this->module_id . "'");
     if ($remove_id) {
         // remove element
         $params = unserialize($result->fields['params']);
         $temp = array();
         $index = 1;
         foreach ($params as $key => $value) {
             if ($index != $remove_id) {
                 $temp[$key] = $value;
             }
             $index++;
         }
         $params = $temp;
     } elseif ($result->fields['params']) {
         // append new url and sort
         $params = unserialize($result->fields['params']);
         $params[$report_id] = $description;
         asort($params);
     } else {
         // first entry
         $params = array($report_id => $description);
     }
     $db->Execute("update " . TABLE_USERS_PROFILES . " set params = '" . serialize($params) . "' \r\n\t\t\twhere user_id = " . $admin_id . " and page_id = '" . $page_id . "' and module_id = '" . $this->module_id . "'");
 }
 function build_main_html()
 {
     global $db, $messageStack;
     // Build heading bar
     $output = '<table border="0" width="100%" cellspacing="0" cellpadding="1">' . chr(10);
     $output .= '  <tr class="dataTableHeadingRow" valign="top">' . chr(10);
     $heading_array = array('id' => GL_HEADING_ACCOUNT_NAME, 'description' => TEXT_ACCT_DESCRIPTION, 'account_type' => GL_INFO_ACCOUNT_TYPE, 'subaccount' => GL_HEADING_SUBACCOUNT);
     $result = html_heading_bar($heading_array, $_GET['list_order']);
     $output .= $result['html_code'];
     $disp_order = $result['disp_order'];
     $output .= '  </tr>' . chr(10);
     // Build field data
     $query_raw = "select id, description, heading_only, primary_acct_id, account_type, account_inactive \r\n\t\tfrom " . $this->db_table . " order by {$disp_order}";
     $page_split = new splitPageResults($_GET['page'], MAX_DISPLAY_SEARCH_RESULTS, $query_raw, $query_numrows);
     $result = $db->Execute($query_raw);
     while (!$result->EOF) {
         $bkgnd = $result->fields['account_inactive'] ? 'style="background-color:pink"' : '';
         $account_type_desc = gen_get_type_description(TABLE_CHART_OF_ACCOUNTS_TYPES, $result->fields['account_type'], false);
         if ($result->fields['heading_only']) {
             $account_type_desc = TEXT_HEADING;
             $bkgnd = 'style="background-color:#cccccc"';
         }
         $output .= '  <tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)">' . chr(10);
         $output .= '    <td class="dataTableContent" ' . $bkgnd . ' onclick="loadPopUp(\'edit\', \'' . $result->fields['id'] . '\')">' . $result->fields['id'] . '</td>' . chr(10);
         $output .= '    <td class="dataTableContent" ' . $bkgnd . ' onclick="loadPopUp(\'edit\', \'' . $result->fields['id'] . '\')">' . htmlspecialchars($result->fields['description']) . '</td>' . chr(10);
         $output .= '    <td class="dataTableContent" ' . $bkgnd . ' onclick="loadPopUp(\'edit\', \'' . $result->fields['id'] . '\')">' . $account_type_desc . '</td>' . chr(10);
         $output .= '    <td class="dataTableContent" ' . $bkgnd . ' onclick="loadPopUp(\'edit\', \'' . $result->fields['id'] . '\')">' . htmlspecialchars($result->fields['primary_acct_id'] ? TEXT_YES . ' - ' . $result->fields['primary_acct_id'] : TEXT_NO) . '</td>' . chr(10);
         $output .= '    <td class="dataTableContent" align="right">' . chr(10);
         if ($this->security_id > 1) {
             $output .= html_icon('actions/edit-find-replace.png', TEXT_EDIT, 'small', 'onclick="loadPopUp(\'edit\', \'' . $result->fields['id'] . '\')"') . chr(10);
         }
         if ($this->security_id > 3) {
             $output .= html_icon('emblems/emblem-unreadable.png', TEXT_DELETE, 'small', 'onclick="if (confirm(\'' . GL_INFO_DELETE_INTRO . '\')) submitSeq(\'' . $result->fields['id'] . '\', \'delete\')"') . chr(10);
         }
         $output .= '    </td>' . chr(10);
         $output .= '  </tr>' . chr(10);
         $result->MoveNext();
     }
     $output .= '</table>' . chr(10);
     $output .= '<div class="page_count_right">' . $page_split->display_links($query_numrows, MAX_DISPLAY_SEARCH_RESULTS, MAX_DISPLAY_PAGE_LINKS, $_GET['page']) . '</div>' . chr(10);
     $output .= '<div class="page_count">' . $page_split->display_count($query_numrows, MAX_DISPLAY_SEARCH_RESULTS, $_GET['page'], GL_DISPLAY_NUMBER_OF_COA) . '</div>' . chr(10);
     return $output;
 }
Example #5
0
 function build_main_html()
 {
     global $db, $messageStack;
     $content = array();
     $content['thead'] = array('value' => array(SETUP_TAX_DESC_SHORT, TEXT_DESCRIPTION, SETUP_TAX_GL_ACCT, SETUP_TAX_RATE, TEXT_ACTION), 'params' => 'width="100%" cellspacing="0" cellpadding="1"');
     $result = $db->Execute("select tax_auth_id, description_short, description_long, account_id, tax_rate \n\t  from " . $this->db_table . " where type = '" . $this->type . "'");
     $rowCnt = 0;
     while (!$result->EOF) {
         $actions = '';
         if ($this->security_id > 1) {
             $actions .= html_icon('actions/edit-find-replace.png', TEXT_EDIT, 'small', 'onclick="loadPopUp(\'' . $this->code . '_edit\', ' . $result->fields['tax_auth_id'] . ')"') . chr(10);
         }
         if ($this->security_id > 3) {
             $actions .= html_icon('emblems/emblem-unreadable.png', TEXT_DELETE, 'small', 'onclick="if (confirm(\'' . SETUP_TAX_AUTH_DELETE_INTRO . '\')) subjectDelete(\'' . $this->code . '\', ' . $result->fields['tax_auth_id'] . ')"') . chr(10);
         }
         $content['tbody'][$rowCnt] = array(array('value' => htmlspecialchars($result->fields['description_short']), 'params' => 'style="cursor:pointer" onclick="loadPopUp(\'' . $this->code . '_edit\',\'' . $result->fields['tax_auth_id'] . '\')"'), array('value' => htmlspecialchars($result->fields['description_long']), 'params' => 'style="cursor:pointer" onclick="loadPopUp(\'' . $this->code . '_edit\',\'' . $result->fields['tax_auth_id'] . '\')"'), array('value' => gen_get_type_description(TABLE_CHART_OF_ACCOUNTS, $result->fields['account_id']), 'params' => 'style="cursor:pointer" onclick="loadPopUp(\'' . $this->code . '_edit\',\'' . $result->fields['tax_auth_id'] . '\')"'), array('value' => $result->fields['tax_rate'], 'params' => 'style="cursor:pointer" onclick="loadPopUp(\'' . $this->code . '_edit\',\'' . $result->fields['tax_auth_id'] . '\')"'), array('value' => $actions, 'params' => 'style="cursor:pointer" align="right"'));
         $result->MoveNext();
         $rowCnt++;
     }
     return html_datatable('' . $this->code . '_' . $this->type . '_table', $content);
 }