// now fall through just like edit // now fall through just like edit case 'edit': case 'update': case 'new': for ($i = 1; $i < 13; $i++) { $j = $i < 10 ? '0' . $i : $i; $expires_month[] = array('id' => sprintf('%02d', $i), 'text' => $j . '-' . strftime('%B', mktime(0, 0, 0, $i, 1, 2000))); } $today = getdate(); for ($i = $today['year']; $i < $today['year'] + 10; $i++) { $year = strftime('%Y', mktime(0, 0, 0, 1, 1, $i)); $expires_year[] = array('id' => $year, 'text' => $year); } // load the tax rates $tax_rates = inv_calculate_tax_drop_down($type); $sales_rep_array = gen_get_rep_ids($type); $result = $db->Execute("select id, contact_first, contact_last, gl_type_account from " . TABLE_CONTACTS . " where type='e'"); $reps = array(); while (!$result->EOF) { $reps[$result->fields['id']] = $result->fields['contact_first'] . ' ' . $result->fields['contact_last']; $result->MoveNext(); } $include_template = 'template_detail.php'; define('PAGE_TITLE', $_REQUEST['action'] == 'new' ? $cInfo->page_title_new : constant('ACT_' . strtoupper($type) . '_PAGE_TITLE_EDIT') . ' - (' . $cInfo->short_name . ') ' . $cInfo->address[m][0]->primary_name); break; default: $heading_array = array('c.short_name' => constant('ACT_' . strtoupper($type) . '_SHORT_NAME')); if ($type == 'e') { $heading_array['c.contact_last,c.contact_first'] = GEN_EMPLOYEE_NAME; } else {
</table> <table class="ui-widget" style="border-collapse:collapse;width:100%"> <thead class="ui-widget-header"> <tr><th colspan="4"><?php echo TEXT_PREFERENCES; ?> </th></tr> </thead> <tbody class="ui-widget-content"> <tr> <td colspan="3"><?php echo CD_03_30_DESC; ?> </td> <td><?php echo html_pull_down_menu('ap_add_sales_tax_to_shipping', inv_calculate_tax_drop_down('v', true), $_POST['ap_add_sales_tax_to_shipping'] ? $_POST['ap_add_sales_tax_to_shipping'] : AP_ADD_SALES_TAX_TO_SHIPPING, ''); ?> </td> </tr> <tr> <td colspan="3"><?php echo CD_03_35_DESC; ?> </td> <td><?php echo html_pull_down_menu('auto_inc_vend_id', $sel_yes_no, $_POST['auto_inc_vend_id'] ? $_POST['auto_inc_vend_id'] : AUTO_INC_VEND_ID, ''); ?> </td> </tr> <tr> <td colspan="3"><?php
break; case 'go_next': $_GET['page']++; break; case 'go_last': $_GET['page'] = 99999; break; case 'search': case 'search_reset': case 'go_page': default: } /***************** prepare to display templates *************************/ // load the tax rates $tax_rates = inv_calculate_tax_drop_down('c'); $purch_tax_rates = inv_calculate_tax_drop_down('v'); // load gl accounts $gl_array_list = gen_coa_pull_down(); $include_header = true; $include_footer = true; $include_tabs = false; $include_calendar = false; switch ($action) { case 'new': define('PAGE_TITLE', BOX_INV_MAINTAIN); $include_template = 'template_id.php'; break; case 'edit': define('PAGE_TITLE', BOX_INV_MAINTAIN); $include_tabs = true; $include_template = 'template_detail.php';
function build_form_html($action, $id = '') { global $db, $currencies; require_once DIR_FS_MODULES . 'phreepos/classes/tills.php'; require_once DIR_FS_MODULES . 'phreepos/defaults.php'; if ($action != 'new' && $this->error == false) { $sql = "select * from " . $this->db_table . " where ot_id = " . $id; $result = $db->Execute($sql); foreach ($result->fields as $key => $value) { $this->{$key} = $value; } } $tills = new tills(); $output = "<script type='text/javascript'>\n\t\t\t\t\t\t\$(document).ready(function(){\n\t\t\t\t\t\t\tchangeOfType();\n\t\t\t\t\t\t});\n\t\t\n\t\t\t\t\t\tfunction changeOfType(){\n\t\t\t\t\t\t\tvar elt = document.getElementById('type');\n\t\t\t\t\t\t\tif(elt.options[elt.selectedIndex].value == 'expenses'){\n\t\t\t\t\t\t\t\t\$('#use_tax_row').show();\n\t\t\t\t\t\t\t\t\$('#tax_row').show();\n\t\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t\t\$('#use_tax_row').hide();\n\t\t\t\t\t\t\t\t\$('#tax_row').hide();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t</script>"; $output .= '<table style="border-collapse:collapse;margin-left:auto; margin-right:auto;">' . chr(10); $output .= ' <thead class="ui-widget-header">' . "\n"; $output .= ' <tr>' . chr(10); $output .= ' <th colspan="2">' . ($action == 'new' ? TEXT_ENTER_NEW_OTHER_TRANSACTION : TEXT_EDIT_OTHER_TRANSACTION) . '</th>' . chr(10); $output .= ' </tr>' . chr(10); $output .= ' </thead>' . "\n"; $output .= ' <tbody class="ui-widget-content">' . "\n"; $output .= ' <tr>' . chr(10); $output .= ' <td>' . TEXT_DESCRIPTION . '</td>' . chr(10); $output .= ' <td>' . html_input_field('description', $this->description, 'size="16" maxlength="15"') . '</td>' . chr(10); $output .= ' </tr>' . chr(10); if ($tills->showDropDown()) { $output .= ' <tr>' . chr(10); $output .= ' <td>' . TEXT_TILLS . '</td>' . chr(10); $output .= ' <td>' . html_pull_down_menu('till_id', $tills->till_array(), $this->till_id ? $this->till_id : $tills->default_till()) . '</td>' . chr(10); $output .= ' </tr>' . chr(10); } else { $output .= html_hidden_field('till_id', $tills->default_till()); } //type change cash or expences. $output .= ' <tr>' . chr(10); $output .= ' <td>' . TEXT_PHREEPOS_TRANSACTION_TYPE . '</td>' . chr(10); $output .= ' <td>' . html_pull_down_menu('type', gen_build_pull_down($ot_options), $this->type, 'onchange="changeOfType();"') . '</td>' . chr(10); $output .= ' </tr>' . chr(10); $output .= ' <tr>' . chr(10); //gl account $output .= ' <tr>' . chr(10); $output .= ' <td>' . TEXT_GL_ACCOUNT . '</td>' . chr(10); $output .= ' <td>' . html_pull_down_menu('gl_acct_id', gen_coa_pull_down(SHOW_FULL_GL_NAMES, true, true, false, false), $this->gl_acct_id) . '</td>' . chr(10); $output .= ' </tr>' . chr(10); $output .= ' <tr>' . chr(10); //Only show this when it are expenses //use show tax $output .= ' <tr id="use_tax_row">' . chr(10); $output .= ' <td>' . TEXT_USE_TAX . '</td>' . chr(10); $output .= ' <td>' . html_checkbox_field('use_tax', '0', $this->use_tax) . '</td>' . chr(10); $output .= ' </tr>' . chr(10); //default tax $output .= ' <tr id="tax_row">' . chr(10); $output .= ' <td>' . TEXT_TAX . '</td>' . chr(10); $output .= ' <td>' . html_pull_down_menu('taxable', inv_calculate_tax_drop_down('v', false), $this->taxable) . '</td>' . chr(10); $output .= ' </tr>' . chr(10); $output .= ' <tr>' . chr(10); $output .= ' </tbody>' . chr(10); $output .= '</table>' . chr(10); return $output; }
function build_form_html($action, $id = '') { global $db, $currencies; if ($action != 'new' && $this->error == false) { $sql = "select * from " . $this->db_table . " where till_id = " . $id; $result = $db->Execute($sql); foreach ($result->fields as $key => $value) { $this->{$key} = $value; } } $tax_rates = inv_calculate_tax_drop_down('c'); $output = '<table style="border-collapse:collapse;margin-left:auto; margin-right:auto;">' . chr(10); $output .= ' <thead class="ui-widget-header">' . "\n"; $output .= ' <tr>' . chr(10); $output .= ' <th colspan="2">' . ($action == 'new' ? TEXT_ENTER_NEW_TILL : TEXT_EDIT_TILL) . '</th>' . chr(10); $output .= ' </tr>' . chr(10); $output .= ' </thead>' . "\n"; $output .= ' <tbody class="ui-widget-content">' . "\n"; $output .= ' <tr>' . chr(10); $output .= ' <td>' . TEXT_DESCRIPTION . '</td>' . chr(10); $output .= ' <td>' . html_input_field('description', $this->description, 'size="16" maxlength="15"') . '</td>' . chr(10); $output .= ' </tr>' . chr(10); $output .= ' <tr>' . chr(10); $output .= ' <td>' . GEN_STORE_ID . '</td>' . chr(10); $output .= ' <td>' . html_pull_down_menu('store_id', $this->store_ids, $this->store_id) . '</td>' . chr(10); $output .= ' </tr>' . chr(10); $output .= ' <tr>' . chr(10); $output .= ' <td>' . TEXT_GL_ACCOUNT . '</td>' . chr(10); $output .= ' <td>' . html_pull_down_menu('gl_acct_id', gen_coa_pull_down(SHOW_FULL_GL_NAMES, true, true, false, $restrict_types = array(0)), $this->gl_acct_id) . '</td>' . chr(10); $output .= ' </tr>' . chr(10); $output .= ' <tr>' . chr(10); $output .= ' <td>' . TEXT_GL_ACCOUNT_ROUNDING . '</td>' . chr(10); $output .= ' <td>' . html_pull_down_menu('rounding_gl_acct_id', gen_coa_pull_down(SHOW_FULL_GL_NAMES, true, true, false, $restrict_types = array(30)), $this->rounding_gl_acct_id) . '</td>' . chr(10); $output .= ' </tr>' . chr(10); $output .= ' <tr>' . chr(10); $output .= ' <td>' . TEXT_DIF_GL_ACCOUNT . '</td>' . chr(10); $output .= ' <td>' . html_pull_down_menu('dif_gl_acct_id', gen_coa_pull_down(SHOW_FULL_GL_NAMES, true, true, false, $restrict_types = array(30)), $this->dif_gl_acct_id) . '</td>' . chr(10); $output .= ' </tr>' . chr(10); $output .= ' <tr>' . chr(10); $output .= ' <td>' . INV_ENTRY_ITEM_TAXABLE . '</td>' . chr(10); $output .= ' <td>' . html_pull_down_menu('tax_id', $tax_rates, $this->tax_id) . '</td>' . chr(10); $output .= ' </tr>' . chr(10); $output .= ' <tr>' . chr(10); $output .= ' <td>' . TEXT_BALANCE . '</td>' . chr(10); $output .= ' <td>' . html_input_field('balance', $currencies->format($this->balance, true, $this->currencies_code)) . '</td>' . chr(10); $output .= ' </tr>' . chr(10); $output .= ' <tr>' . chr(10); $output .= ' <td>' . TEXT_MAX_DISCOUNT . '</td>' . chr(10); $output .= ' <td>' . html_input_field('max_discount', $this->max_discount, 'size="16" maxlength="15"') . '</td>' . chr(10); $output .= ' </tr>' . chr(10); //default currency if (ENABLE_MULTI_CURRENCY) { // show currency slection pulldown $output .= ' <tr>' . chr(10); $output .= ' <td>' . TEXT_CURRENCY . '</td>' . chr(10); $output .= ' <td>' . html_pull_down_menu('currencies_code', gen_get_pull_down(TABLE_CURRENCIES, false, false, 'code', 'title'), $this->currencies_code) . '</td>' . chr(10); $output .= ' </tr>' . chr(10); //restrict to this currency $output .= ' <tr>' . chr(10); $output .= ' <td>' . TEXT_RESTRICT_CURRENCY . '</td>' . chr(10); $output .= ' <td>' . html_checkbox_field('restrict_currency', '1', $this->restrict_currency) . '</td>' . chr(10); $output .= ' </tr>' . chr(10); } //end default currency //printer information $output .= ' <tr>' . chr(10); $output .= ' <td>' . PHREEPOS_RECEIPT_PRINTER_NAME_DESC . '<br><br></td>' . chr(10); $output .= ' <td>' . html_input_field('printer_name', $this->printer_name) . '</td>' . chr(10); $output .= ' </tr>' . chr(10); $output .= ' <tr>' . chr(10); $output .= ' <td>' . PHREEPOS_RECEIPT_PRINTER_STARTING_LINE_DESC . '<br><br></td>' . chr(10); $output .= ' <td>' . html_input_field('printer_starting_line', $this->printer_starting_line) . '</td>' . chr(10); $output .= ' </tr>' . chr(10); $output .= ' <tr>' . chr(10); $output .= ' <td>' . PHREEPOS_RECEIPT_PRINTER_CLOSING_LINE_DESC . '<a href="' . DIR_WS_ADMIN . 'modules/phreepos/printer_codes.htm">' . TEXT_DRAWER_CODES . '</a> <br><br></td>' . chr(10); $output .= ' <td>' . html_input_field('printer_closing_line', $this->printer_closing_line) . '</td>' . chr(10); $output .= ' </tr>' . chr(10); $output .= ' <tr>' . chr(10); $output .= ' <td>' . PHREEPOS_RECEIPT_PRINTER_OPEN_DRAWER_DESC . '<br><br></td>' . chr(10); $output .= ' <td>' . html_input_field('printer_open_drawer', $this->printer_open_drawer) . '</td>' . chr(10); $output .= ' </tr>' . chr(10); //end printer information $output .= ' </tbody>' . chr(10); $output .= '</table>' . chr(10); return $output; }