Beispiel #1
0
 function build_main_html()
 {
     global $db, $messageStack;
     $tax_authorities_array = gen_build_tax_auth_array();
     $content = array();
     $content['thead'] = array('value' => array(SETUP_TAX_DESC_SHORT, TEXT_DESCRIPTION, SETUP_HEADING_TOTAL_TAX, SETUP_HEADING_TAX_FREIGHT, TEXT_ACTION), 'params' => 'width="100%" cellspacing="0" cellpadding="1"');
     $result = $db->Execute("select tax_rate_id, description_short, description_long, rate_accounts, freight_taxable \n\t\tfrom " . $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_rate_id'] . ')"') . chr(10);
         }
         if ($this->security_id > 3) {
             $actions .= html_icon('emblems/emblem-unreadable.png', TEXT_DELETE, 'small', 'onclick="if (confirm(\'' . SETUP_TAX_DELETE_INTRO . '\')) subjectDelete(\'' . $this->code . '\', ' . $result->fields['tax_rate_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_rate_id'] . '\')"'), array('value' => htmlspecialchars($result->fields['description_long']), 'params' => 'style="cursor:pointer" onclick="loadPopUp(\'' . $this->code . '_edit\',\'' . $result->fields['tax_rate_id'] . '\')"'), array('value' => gen_calculate_tax_rate($result->fields['rate_accounts'], $tax_authorities_array), 'params' => 'style="cursor:pointer" onclick="loadPopUp(\'' . $this->code . '_edit\',\'' . $result->fields['tax_rate_id'] . '\')"'), array('value' => $result->fields['freight_taxable'] ? TEXT_YES : TEXT_NO, 'params' => 'style="cursor:pointer" onclick="loadPopUp(\'' . $this->code . '_edit\',\'' . $result->fields['tax_rate_id'] . '\')"'), array('value' => $actions, 'params' => 'style="cursor:pointer" align="right"'));
         $result->MoveNext();
         $rowCnt++;
     }
     return html_datatable('' . $this->code . '_' . $this->type . '_table', $content);
 }
Beispiel #2
0
function ord_calculate_tax_drop_down($type = 'c')
{
    global $db;
    $tax_auth_array = gen_build_tax_auth_array();
    $sql = "select tax_rate_id, description_short, rate_accounts from " . TABLE_TAX_RATES;
    switch ($type) {
        default:
        case 'c':
        case 'v':
            $sql .= " where type = '" . $type . "'";
            break;
        case 'b':
            // both
    }
    $tax_rates = $db->Execute($sql);
    $tax_rate_drop_down = array();
    $tax_rate_drop_down[] = array('id' => '0', 'rate' => '0', 'text' => TEXT_NONE, 'auths' => '');
    while (!$tax_rates->EOF) {
        $tax_rate_drop_down[] = array('id' => $tax_rates->fields['tax_rate_id'], 'rate' => gen_calculate_tax_rate($tax_rates->fields['rate_accounts'], $tax_auth_array), 'text' => $tax_rates->fields['description_short'], 'auths' => $tax_rates->fields['rate_accounts']);
        $tax_rates->MoveNext();
    }
    return $tax_rate_drop_down;
}
 function build_main_html()
 {
     global $db, $messageStack;
     $tax_authorities_array = gen_build_tax_auth_array();
     // 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_HEADING_TOTAL_TAX, 'tax_rate' => SETUP_HEADING_TAX_FREIGHT);
     $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_rate_id, description_short, description_long, rate_accounts, freight_taxable \r\n\t\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_rate_id'] . ')">' . htmlspecialchars($result->fields['description_short']) . '</td>' . chr(10);
         $output .= '    <td class="dataTableContent" onclick="loadPopUp(\'edit\', ' . $result->fields['tax_rate_id'] . ')">' . gen_calculate_tax_rate($result->fields['rate_accounts'], $tax_authorities_array) . '</td>' . chr(10);
         $output .= '    <td class="dataTableContent" onclick="loadPopUp(\'edit\', ' . $result->fields['tax_rate_id'] . ')">' . ($result->fields['freight_taxable'] ? TEXT_YES : 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['tax_rate_id'] . ')"') . chr(10);
         }
         if ($this->security_id > 3) {
             $output .= html_icon('emblems/emblem-unreadable.png', TEXT_DELETE, 'small', 'onclick="if (confirm(\'' . SETUP_TAX_DELETE_INTRO . '\')) submitSeq(' . $result->fields['tax_rate_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_RATES) . '</div>' . chr(10);
     return $output;
 }