From: Joe Hunt Date: Sun, 17 Feb 2008 15:58:37 +0000 (+0000) Subject: Minor change in menu and function in view_print_transaction.php X-Git-Tag: v2.4.2~19^2~2231 X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=commitdiff_plain;h=c9190b6913691b997ba27e0804e329ee7a3d6f53;hp=9a3a8ed9f332f5483e049a82795d7215a79b1f99;p=fa-stable.git Minor change in menu and function in view_print_transaction.php Preparing for print of single documents Removing 'out' field in table tax_types --- diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 670871cf..9068c38e 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -19,6 +19,17 @@ Legend: ! -> Note $ -> Affected files +17-Feb-2008 Joe Hunt +! Minor change in menu and function in view_print_transaction.php +$ /admin/view_print_transaction.php + /application/setup.php ++ Preparing for print of single documents +$ /reporting/includes/reporting.inc +! Removing 'out' field in table tax_types +$ /sql/alter.sql + /taxes/tax_types.php + /taxes/db/tax_types_db.inc + 11-Feb-2008 Joe Hunt + Added file, update_db.php, for updating company databases from an SQL script. $ update_db.php (New file) diff --git a/admin/view_print_transaction.php b/admin/view_print_transaction.php index 1fcb3080..0b3a2c88 100644 --- a/admin/view_print_transaction.php +++ b/admin/view_print_transaction.php @@ -13,7 +13,7 @@ include_once($path_to_root . "/reporting/includes/reporting.inc"); $js = ""; if ($use_popup_windows) $js .= get_js_open_window(800, 500); -page(_("View or Print Transactions"), false, false, "", $js); +page(_("View Transactions"), false, false, "", $js); //---------------------------------------------------------------------------------------- @@ -26,6 +26,11 @@ function viewing_controls() systypes_list_cells(_("Type:"), 'filterType', null, true); + if (!isset($_POST['FromTransNo'])) + $_POST['FromTransNo'] = "1"; + if (!isset($_POST['ToTransNo'])) + $_POST['ToTransNo'] = "999999"; + ref_cells(_("from #:"), 'FromTransNo'); ref_cells(_("to #:"), 'ToTransNo'); @@ -53,6 +58,8 @@ function check_valid_entries() echo _("The ending transaction number is expected to be numeric and greater than zero."); return false; } + if ($_POST['filterType'] == "") + return false; return true; } @@ -66,6 +73,9 @@ function handle_search() { $db_info = get_systype_db_info($_POST['filterType']); + if ($db_info == null) + return; + $table_name = $db_info[0]; $type_name = $db_info[1]; $trans_no_name = $db_info[2]; @@ -87,7 +97,7 @@ function handle_search() $result = db_query($sql, "could not query transactions on $table_name"); - if (db_num_rows($result) == 0) + if (db_num_rows($result) == 0) { echo _("There are no transactions for the given parameters."); return; @@ -95,12 +105,12 @@ function handle_search() start_table($table_style); if ($trans_ref) - $th = array(_("#"), _("Reference"), _("View"), _("Print")); - else - $th = array(_("#"), _("View"), _("Print")); - table_header($th); + $th = array(_("#"), _("Reference"), _("View"), _("GL")); + else + $th = array(_("#"), _("View"), _("GL")); + table_header($th); $k = 0; - while ($line = db_fetch($result)) + while ($line = db_fetch($result)) { alt_table_row_color($k); @@ -109,27 +119,9 @@ function handle_search() if ($trans_ref) label_cell($line[$trans_ref]); label_cell(get_trans_view_str($_POST['filterType'],$line[$trans_no_name], _("View"))); - label_cell(get_gl_view_str_cell($_POST['filterType'], $line[$trans_no_name], _("View GL"))); + label_cell(get_gl_view_str($_POST['filterType'], $line[$trans_no_name], _("View GL"))); - $forms = get_form_entries($_POST['filterType'], $line[$trans_no_name]); - while ($form_item = db_fetch($forms)) - { - - $param1 = $form_item['param1']; - $param2 = $form_item['param2']; - - if ($_POST['filterType'] == systypes::bank_payment() - || $_POST['filterType'] == systypes::bank_deposit() - || $_POST['filterType'] == systypes::cust_payment() - || $_POST['filterType'] == systypes::supp_payment()) - { - $param1 = payment_person_types::type_name($form_item['param1']); - $param2 = payment_person_types::person_name($form_item['param1'], $form_item['param2'], false); - } - - //label_cell(printTransaction(_("Print") . " " . getFormTypeName($form_item["form_type"]), $form_item['form_id'], $form_item['form_type'], $_POST['filterType'], $line[$trans_no_name], $line[$trans_ref], $param1, $param2)); - } - end_row(); + end_row(); } @@ -149,8 +141,6 @@ if (isset($_POST['ProcessSearch'])) viewing_controls(); -//echo getHiddenFieldScript(); - handle_search(); br(2); diff --git a/applications/setup.php b/applications/setup.php index b3b0436e..df850c3d 100644 --- a/applications/setup.php +++ b/applications/setup.php @@ -1,9 +1,9 @@ application("system",_("Setup")); @@ -26,7 +26,7 @@ $this->add_module(_("Maintanance")); $this->add_lapp_function(2, _("Void a Transaction"),"admin/void_transaction.php?"); - $this->add_lapp_function(2, _("View or Print Transactions"),"admin/view_print_transaction.php?"); + $this->add_lapp_function(2, _("View Transactions"),"admin/view_print_transaction.php?"); $this->add_rapp_function(2, _("Backup and Restore"),"admin/backups.php?", 15); $this->add_rapp_function(2, _("Create/Update Companies"),"admin/create_coy.php?", 14); $this->add_rapp_function(2, _("Install/Update Languages"),"admin/inst_lang.php?", 14); @@ -38,7 +38,7 @@ if ($mod["tab"] == "system") $this->add_rapp_function(2, $mod["name"], "modules/".$mod["path"]."/".$mod["filename"]."?"); } - } + } } } diff --git a/reporting/includes/reporting.inc b/reporting/includes/reporting.inc index 15cfee6a..f1da464e 100644 --- a/reporting/includes/reporting.inc +++ b/reporting/includes/reporting.inc @@ -1,42 +1,75 @@ $_SESSION["wa_current_user"]->company, - 'FORMID' => $form_id, - 'FORMTYPE' => $form_type, - 'TRANSNO' => $trans_no, - 'TRANSTYPE' => $trans_type, - 'REF' => $ref, - 'PARAM1' => $param1, - 'PARAM2' => $param2 - ); - $pdf_href = getPDFOpenScript($link_text, $ar); - return "" . _($link_text) . ""; -} -function getHiddenFieldScript() { - $ar = Array('COMPANY','LANG','FORMID','FORMTYPE','TRANSNO','TRANSTYPE','REF','PARAM1','PARAM2'); - foreach ($ar as $value) $st.= ""; - - $st .= " - - "; - - $st = "
" . $st . "
"; - return $st; -} +// Put this on the page only once, e.g. print_hidden_script(systypes::sales_order()); + +function print_hidden_script($type_no) +{ + global $path_to_root; + include_once($path_to_root . "/includes/types.inc"); + $action = ""; + $_POST['PARAM_0'] = $_POST['PARAM_1'] = 0; // the document no. is updated in print_document_link(). -function getPDFOpenScript($link_text, $ar_params) { - $st = "document.pdf_form.LANG.value='" . $_SESSION['language']->code . "';"; - foreach ($ar_params as $key => $value) { - $st .= "document.pdf_form.{$key}.value = '{$value}';"; + switch ($type_no) + { + case systypes::sales_order() : + $action = "$path_to_root/reporting/rep109.php"; + $_POST['PARAM_2'] = ""; // currency + $_POST['PARAM_3'] = ""; // bank account + $_POST['PARAM_4'] = 0; // email + $_POST['PARAM_5'] = 0; // quote + $_POST['PARAM_6'] = ""; // comments + $params = 7; + break; + case systypes::cust_dispatch() : + $action = "$path_to_root/reporting/rep110.php"; + $_POST['PARAM_2'] = 0; // email + $_POST['PARAM_3'] = ""; // comments + $params = 4; + break; + case 10 : // Sales Invoice + case 11 : // Customer Credit Note + $action = "$path_to_root/reporting/rep107.php"; + $_POST['PARAM_2'] = ""; // currency + $_POST['PARAM_3'] = ""; // bank account + $_POST['PARAM_4'] = 0; // email + $_POST['PARAM_5'] = ""; // paylink + $_POST['PARAM_6'] = ""; // comments + $params = 7; + break; + case systypes::po() : + $action = "$path_to_root/reporting/rep209.php"; + $_POST['PARAM_2'] = ""; // currency + $_POST['PARAM_3'] = ""; // bank account + $_POST['PARAM_4'] = 0; // email + $_POST['PARAM_5'] = ""; // comments + $params = 6; + break; } - $st.= "window.open('','REP_WINDOW','toolbar=no,scrollbar=no,resizable=yes,menubar=no');"; - $st.= "document.pdf_form.target='REP_WINDOW';"; - $st.= "document.pdf_form.action= '" . C_JSP_ROOT . "/reporting/gen_pdf_form.jsp';"; - $st.= "document.pdf_form.submit();"; - - return $st; + $st = ""; + for ($i = 0; $i < $params; $i++) + { + $st .= ""; + } + $st = "
" . $st . "
\n"; + echo $st; } +// Ex. label_cell(print_document_link($myrow['order_no'], _("Print"))); +// or display_note(print_document_link($order_no, _("Print this order"))); +// or if a button +// echo "\n"; + +function print_document_link($doc_no, $link_text, $link=true) +{ + $st = "document.pdf_form.PARAM_0.value = '$doc_no';"; + $st .= "document.pdf_form.PARAM_1.value = '$doc_no';"; + $st .= "window.open('','REP_WINDOW','toolbar=no,scrollbar=no,resizable=yes,menubar=no'); + document.pdf_form.target='REP_WINDOW'; + document.pdf_form.submit();\n"; + if ($link) + return "" . $link_text . ""; + else + return "javascript:$st"; +} ?> \ No newline at end of file diff --git a/sql/alter.sql b/sql/alter.sql index b6021979..9c50af4b 100644 --- a/sql/alter.sql +++ b/sql/alter.sql @@ -13,14 +13,20 @@ -- -------------------------------------------------------- -- --- ALTER TABLE for `0_company` +-- ALTER TABLE -- -ALTER TABLE `0_supp_invoice_items` CHANGE `gl_code` `gl_code` VARCHAR(11) NOT NULL DEFAULT '0'; +ALTER TABLE `0_tax_types` DROP `out`; +ALTER TABLE `0_debtor_trans_details` ADD COLUMN `qty_done` double NOT NULL default '0'; + +ALTER TABLE `0_debtor_trans` ADD COLUMN `trans_link` int(11) NOT NULL default '0'; +INSERT INTO `0_sys_types` VALUES ('13', 'Delivery', '1', '1'); +ALTER TABLE `0_sales_order_details` CHANGE `qty_invoiced` `qty_sent` DOUBLE NOT NULL default '0'; + +ALTER TABLE `0_supp_invoice_items` CHANGE `gl_code` `gl_code` VARCHAR(11) NOT NULL DEFAULT '0'; ALTER TABLE `0_sales_order_details` DROP PRIMARY KEY; ALTER TABLE `0_sales_order_details` ADD `id` INTEGER(11) NOT NULL AUTO_INCREMENT FIRST, ADD PRIMARY KEY (`id`); -ALTER TABLE `0_sales_order_details` CHANGE `qty_invoiced` `qty_sent` DOUBLE NOT NULL default '0'; ALTER TABLE `0_company` ADD `no_item_list` TINYINT(1) NOT NULL DEFAULT '0' AFTER `f_year`; ALTER TABLE `0_company` ADD `no_customer_list` TINYINT(1) NOT NULL DEFAULT '0' AFTER `no_item_list`; @@ -30,7 +36,3 @@ ALTER TABLE `0_salesman` ADD `provision` DOUBLE NOT NULL DEFAULT '0' AFTER `sale ALTER TABLE `0_salesman` ADD `break_pt` DOUBLE NOT NULL DEFAULT '0' AFTER `provision`; ALTER TABLE `0_salesman` ADD `provision2` DOUBLE NOT NULL DEFAULT '0' AFTER `break_pt`; -ALTER TABLE `0_debtor_trans_details` ADD COLUMN `qty_done` double NOT NULL default '0'; -ALTER TABLE `0_debtor_trans` ADD COLUMN `trans_link` int(11) NOT NULL default '0'; - -INSERT INTO `0_sys_types` VALUES ('13', 'Delivery', '1', '1'); diff --git a/taxes/db/tax_types_db.inc b/taxes/db/tax_types_db.inc index c5408af0..029cad16 100644 --- a/taxes/db/tax_types_db.inc +++ b/taxes/db/tax_types_db.inc @@ -1,66 +1,65 @@ \ No newline at end of file diff --git a/taxes/tax_types.php b/taxes/tax_types.php index d5b5e60b..d70493c8 100644 --- a/taxes/tax_types.php +++ b/taxes/tax_types.php @@ -3,7 +3,6 @@ $page_security = 3; $path_to_root=".."; include($path_to_root . "/includes/session.inc"); - page(_("Tax Types")); include_once($path_to_root . "/includes/ui.inc"); @@ -12,26 +11,26 @@ include_once($path_to_root . "/taxes/db/tax_types_db.inc"); if (isset($_GET['selected_id'])) { $selected_id = $_GET['selected_id']; -} +} elseif(isset($_POST['selected_id'])) { $selected_id = $_POST['selected_id']; } //----------------------------------------------------------------------------------- -function can_process() +function can_process() { - if (strlen($_POST['name']) == 0) + if (strlen($_POST['name']) == 0) { display_error(_("The tax type name cannot be empty.")); return false; - } - elseif (!is_numeric($_POST['rate'])) + } + elseif (!is_numeric($_POST['rate'])) { display_error( _("The default tax rate must be numeric.")); return false; - } - elseif ($_POST['rate'] < 0) + } + elseif ($_POST['rate'] < 0) { display_error( _("The default tax rate cannot be less than zero.")); return false; @@ -42,21 +41,21 @@ function can_process() //----------------------------------------------------------------------------------- -if (isset($_POST['ADD_ITEM']) && can_process()) +if (isset($_POST['ADD_ITEM']) && can_process()) { add_tax_type($_POST['name'], $_POST['sales_gl_code'], - $_POST['purchasing_gl_code'], $_POST['rate'], check_value('out')); + $_POST['purchasing_gl_code'], $_POST['rate']); meta_forward($_SERVER['PHP_SELF']); } //----------------------------------------------------------------------------------- -if (isset($_POST['UPDATE_ITEM']) && can_process()) +if (isset($_POST['UPDATE_ITEM']) && can_process()) { update_tax_type($selected_id, $_POST['name'], - $_POST['sales_gl_code'], $_POST['purchasing_gl_code'], $_POST['rate'], check_value('out')); + $_POST['sales_gl_code'], $_POST['purchasing_gl_code'], $_POST['rate']); meta_forward($_SERVER['PHP_SELF']); } @@ -67,7 +66,7 @@ function can_delete($selected_id) $sql= "SELECT COUNT(*) FROM ".TB_PREF."tax_group_items WHERE tax_type_id=$selected_id"; $result = db_query($sql, "could not query tax groups"); $myrow = db_fetch_row($result); - if ($myrow[0] > 0) + if ($myrow[0] > 0) { display_error(_("Cannot delete this tax type because tax groups been created referring to it.")); return false; @@ -79,7 +78,7 @@ function can_delete($selected_id) //----------------------------------------------------------------------------------- -if (isset($_GET['delete'])) +if (isset($_GET['delete'])) { if (can_delete($selected_id)) @@ -96,27 +95,23 @@ $result = get_all_tax_types(); start_table($table_style); $th = array(_("Description"), _("Default Rate (%)"), - _("Sales GL Account"), _("Purchasing GL Account"), _("Outstanding"), "", ""); -table_header($th); + _("Sales GL Account"), _("Purchasing GL Account"), "", ""); +table_header($th); $k = 0; -while ($myrow = db_fetch($result)) +while ($myrow = db_fetch($result)) { - if ($myrow['out'] == 1) - $out = _("Yes"); - else - $out = _("No"); alt_table_row_color($k); label_cell($myrow["name"]); label_cell(number_format2($myrow["rate"],user_percent_dec()), "align=right"); label_cell($myrow["sales_gl_code"] . " " . $myrow["SalesAccountName"]); label_cell($myrow["purchasing_gl_code"] . " " . $myrow["PurchasingAccountName"]); - label_cell($out); edit_link_cell("selected_id=".$myrow["id"]); delete_link_cell("selected_id=".$myrow["id"]."&delete=1"); + end_row(); } @@ -132,7 +127,7 @@ start_form(); start_table($table_style2); -if (isset($selected_id)) +if (isset($selected_id)) { //editing an existing status code @@ -142,7 +137,6 @@ if (isset($selected_id)) $_POST['rate'] = $myrow["rate"]; $_POST['sales_gl_code'] = $myrow["sales_gl_code"]; $_POST['purchasing_gl_code'] = $myrow["purchasing_gl_code"]; - $_POST['out'] = $myrow["out"]; hidden('selected_id', $selected_id); } @@ -152,8 +146,6 @@ text_row_ex(_("Default Rate:"), 'rate', 10, 10, "", "%"); gl_all_accounts_list_row(_("Sales GL Account:"), 'sales_gl_code', null); gl_all_accounts_list_row(_("Purchasing GL Account:"), 'purchasing_gl_code', null); -check_row(_("Outstanding:"), 'out', null); - end_table(1); submit_add_or_update_center(!isset($selected_id));