From: Joe Hunt Date: Thu, 15 Apr 2010 08:50:15 +0000 (+0000) Subject: Added a date column and combined the # and View column in 'View / Print Transactions. X-Git-Tag: v2.4.2~19^2~911 X-Git-Url: https://delta.frontaccounting.com/gitweb/?p=fa-stable.git;a=commitdiff_plain;h=df3ebb4251529abb480179600417fe7164951fe2 Added a date column and combined the # and View column in 'View / Print Transactions. Changed Voiding Transaction to also include a pager. --- diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 23f7c459..9ed47cda 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -19,6 +19,16 @@ Legend: ! -> Note $ -> Affected files +15-Apr-2010 Joe Hunt +! Added a date column and combined the # and View column in 'View / Print Transactions. +! Changed Voiding Transaction to also include a pager. +$ /admin/view_print_transaction.php + /admin/void_transaction.php + /admin/db/transaction_db.inc + /includes/systypes.inc + /manufacturing/view/wo_production_view.php + /reporting/includes/reporting.inc + 14-Apr-2010 Joe Hunt ! Replaced the global variables for table styles to defined CSS classes. $ all files that includes the call to start_table and start_outer_table diff --git a/admin/db/transactions_db.inc b/admin/db/transactions_db.inc index 09814938..b5ba0cd3 100644 --- a/admin/db/transactions_db.inc +++ b/admin/db/transactions_db.inc @@ -23,19 +23,25 @@ function get_sql_for_view_transactions($filtertype, $from, $to, &$trans_ref) $type_name = $db_info[1]; $trans_no_name = $db_info[2]; $trans_ref = $db_info[3]; + $trans_date = $db_info[4]; $sql = "SELECT DISTINCT $trans_no_name as trans_no"; if ($trans_ref) - $sql .= " ,$trans_ref "; - - $sql .= ", ".$filtertype." as type FROM $table_name - WHERE $trans_no_name >= ".db_escape($from). " - AND $trans_no_name <= ".db_escape($to); - - if ($type_name != null) - $sql .= " AND `$type_name` = ".db_escape($filtertype); - + $sql .= " ,$trans_ref as ref "; + $sql .= ",$trans_date as trans_date"; + if ($type_name) + $sql .= ", ".$type_name." as type"; + $sql .= " FROM $table_name "; + if ($from != null && $to != null) + { + $sql .= " WHERE $trans_no_name >= ".db_escape($from). " + AND $trans_no_name <= ".db_escape($to); + if ($type_name != null) + $sql .= " AND `$type_name` = ".db_escape($filtertype); + } + elseif ($type_name != null) + $sql .= " WHERE `$type_name` = ".db_escape($filtertype); $sql .= " ORDER BY $trans_no_name"; return $sql; } diff --git a/admin/view_print_transaction.php b/admin/view_print_transaction.php index 5a6d5738..7e72bb33 100644 --- a/admin/view_print_transaction.php +++ b/admin/view_print_transaction.php @@ -29,20 +29,39 @@ page(_($help_context = "View or Print Transactions"), false, false, "", $js); //---------------------------------------------------------------------------------------- function view_link($trans) { + if (!isset($trans['type'])) + $trans['type'] = $_POST['filterType']; return get_trans_view_str($trans["type"], $trans["trans_no"]); } function prt_link($row) { - if ($row['type'] != ST_CUSTPAYMENT && $row['type'] != ST_BANKDEPOSIT) // customer payment or bank deposit printout not defined yet. + if (!isset($row['type'])) + $row['type'] = $_POST['filterType']; + if ($row['type'] == ST_PURCHORDER || $row['type'] == ST_SALESORDER || $row['type'] == ST_SALESQUOTE || + $row['type'] == ST_WORKORDER) return print_document_link($row['trans_no'], _("Print"), true, $row['type'], ICON_PRINT); + else + return print_document_link($row['trans_no']."-".$row['type'], _("Print"), true, $row['type'], ICON_PRINT); } function gl_view($row) { + if (!isset($row['type'])) + $row['type'] = $_POST['filterType']; return get_gl_view_str($row["type"], $row["trans_no"]); } +function date_view($row) +{ + return $row['trans_date']; +} + +function ref_view($row) +{ + return $row['ref']; +} + function viewing_controls() { display_note(_("Only documents can be printed.")); @@ -100,12 +119,13 @@ function handle_search() $print_type = $_POST['filterType']; $print_out = ($print_type == ST_SALESINVOICE || $print_type == ST_CUSTCREDIT || $print_type == ST_CUSTDELIVERY || - $print_type == ST_PURCHORDER || $print_type == ST_SALESORDER || $print_type == ST_SALESQUOTE); + $print_type == ST_PURCHORDER || $print_type == ST_SALESORDER || $print_type == ST_SALESQUOTE || + $print_type == ST_CUSTPAYMENT || $print_type == ST_SUPPAYMENT || $print_type == ST_WORKORDER); $cols = array( - _("#"), - _("Reference"), - _("View") => array('insert'=>true, 'fun'=>'view_link'), + _("#") => array('insert'=>true, 'fun'=>'view_link'), + _("Reference") => array('fun'=>'ref_view'), + _("Date") => array('type'=>'date', 'fun'=>'date_view'), _("Print") => array('insert'=>true, 'fun'=>'prt_link'), _("GL") => array('insert'=>true, 'fun'=>'gl_view') ); diff --git a/admin/void_transaction.php b/admin/void_transaction.php index 0dcd918d..d91c53d0 100644 --- a/admin/void_transaction.php +++ b/admin/void_transaction.php @@ -11,11 +11,13 @@ ***********************************************************************/ $page_security = 'SA_VOIDTRANSACTION'; $path_to_root = ".."; +include($path_to_root . "/includes/db_pager.inc"); include_once($path_to_root . "/includes/session.inc"); include_once($path_to_root . "/includes/date_functions.inc"); include_once($path_to_root . "/includes/ui.inc"); include_once($path_to_root . "/includes/data_checks.inc"); +include_once($path_to_root . "/admin/db/transactions_db.inc"); include_once($path_to_root . "/admin/db/voiding_db.inc"); $js = ""; @@ -26,6 +28,7 @@ if ($use_popup_windows) page(_($help_context = "Void a Transaction"), false, false, "", $js); +simple_page_mode(true); //---------------------------------------------------------------------------------------- function exist_transaction($type, $type_no) { @@ -102,14 +105,84 @@ function exist_transaction($type, $type_no) return true; } +function view_link($trans) +{ + if (!isset($trans['type'])) + $trans['type'] = $_POST['filterType']; + return get_trans_view_str($trans["type"], $trans["trans_no"]); +} + +function select_link($row) +{ + if (!isset($row['type'])) + $row['type'] = $_POST['filterType']; + return button('Edit'.$row["trans_no"], _("Select"), _("Select"), ICON_EDIT); +} + +function gl_view($row) +{ + if (!isset($row['type'])) + $row['type'] = $_POST['filterType']; + return get_gl_view_str($row["type"], $row["trans_no"]); +} + +function date_view($row) +{ + return $row['trans_date']; +} + +function ref_view($row) +{ + return $row['ref']; +} + function voiding_controls() { + global $selected_id; start_form(); - start_table(TABLESTYLE2); + start_table(TABLESTYLE_NOBORDER); + start_row(); + + systypes_list_cells(_("Transaction Type:"), 'filterType', null, true); + if (list_updated('filterType')) + $selected_id = -1; - systypes_list_row(_("Transaction Type:"), "filterType", null, true); + end_row(); + end_table(1); + + $trans_ref = false; + $sql = get_sql_for_view_transactions($_POST['filterType'], null, null, $trans_ref); + if ($sql == "") + return; + + $cols = array( + _("#") => array('insert'=>true, 'fun'=>'view_link'), + _("Reference") => array('fun'=>'ref_view'), + _("Date") => array('type'=>'date', 'fun'=>'date_view'), + _("GL") => array('insert'=>true, 'fun'=>'gl_view'), + _("Select") => array('insert'=>true, 'fun'=>'select_link') + ); + if(!$trans_ref) { + array_remove($cols, 1); + } + $table =& new_db_pager('transactions', $sql, $cols); + $table->width = "40%"; + display_db_pager($table); + + start_table(TABLESTYLE2); + + //systypes_list_row(_("Transaction Type:"), "filterType", null, true); + + if ($selected_id != -1) + { + $_POST['trans_no'] = $selected_id; + hidden('selected_id', $selected_id); + } + else + $_POST['trans_no'] = ''; + text_row(_("Transaction #:"), 'trans_no', null, 12, 12); date_row(_("Voiding Date:"), 'date_'); @@ -133,11 +206,6 @@ function voiding_controls() else { display_warning(_("Are you sure you want to void this transaction ? This action cannot be undone."), 0, 1); - if ($_POST['filterType'] == ST_JOURNAL) // GL transaction are not included in get_trans_view_str - $view_str = get_gl_view_str($_POST['filterType'],$_POST['trans_no'], _("View Transaction")); - else - $view_str = get_trans_view_str($_POST['filterType'],$_POST['trans_no'], _("View Transaction")); - display_note($view_str); br(); submit_center_first('ConfirmVoiding', _("Proceed"), '', true); submit_center_last('CancelVoiding', _("Cancel"), '', 'cancel'); @@ -239,6 +307,7 @@ if (isset($_POST['ConfirmVoiding'])) if (isset($_POST['CancelVoiding'])) { + $selected_id = -1; $Ajax->activate('_page_body'); } diff --git a/includes/systypes.inc b/includes/systypes.inc index 969960cd..1c91abc2 100644 --- a/includes/systypes.inc +++ b/includes/systypes.inc @@ -51,7 +51,7 @@ function get_systype_db_info($type) case ST_CUSTDELIVERY : return array("".TB_PREF."debtor_trans", "type", "trans_no", "reference", "tran_date"); case ST_LOCTRANSFER : return array("".TB_PREF."stock_moves", "type", "trans_no", "reference", "tran_date"); case ST_INVADJUST : return array("".TB_PREF."stock_moves", "type", "trans_no", "reference", "tran_date"); - case ST_PURCHORDER : return array("".TB_PREF."purch_orders", null, "order_no", "reference", "tran_date"); + case ST_PURCHORDER : return array("".TB_PREF."purch_orders", null, "order_no", "reference", "ord_date"); case ST_SUPPINVOICE : return array("".TB_PREF."supp_trans", "type", "trans_no", "reference", "tran_date"); case ST_SUPPCREDIT : return array("".TB_PREF."supp_trans", "type", "trans_no", "reference", "tran_date"); case ST_SUPPAYMENT : return array("".TB_PREF."supp_trans", "type", "trans_no", "reference", "tran_date"); diff --git a/manufacturing/view/wo_production_view.php b/manufacturing/view/wo_production_view.php index e3aa2ef6..985bf643 100644 --- a/manufacturing/view/wo_production_view.php +++ b/manufacturing/view/wo_production_view.php @@ -71,7 +71,7 @@ display_wo_production($wo_production); br(2); -end_page(true, false, false, ST_MANURECEIVE], $wo_production); +end_page(true, false, false, ST_MANURECEIVE, $wo_production); ?> diff --git a/reporting/includes/reporting.inc b/reporting/includes/reporting.inc index 2bfa4257..9491c0c0 100644 --- a/reporting/includes/reporting.inc +++ b/reporting/includes/reporting.inc @@ -96,6 +96,16 @@ function print_document_link($doc_no, $link_text, $link=true, $type_no, 'PARAM_3' => $email, 'PARAM_4' => ''); break; + case ST_WORKORDER : + $rep = 409; + // from, to, currency, bank acc, email, comments + $ar = array( + 'PARAM_0' => $doc_no, + 'PARAM_1' => $doc_no, + 'PARAM_2' => $email, + 'PARAM_3' => '', + 'PARAM_4' => ''); + break; // default: $ar = array(); }