Changed Voiding Transaction to also include a pager.
! -> 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
$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;
}
//----------------------------------------------------------------------------------------
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."));
$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')
);
***********************************************************************/
$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 = "";
page(_($help_context = "Void a Transaction"), false, false, "", $js);
+simple_page_mode(true);
//----------------------------------------------------------------------------------------
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_');
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');
if (isset($_POST['CancelVoiding']))
{
+ $selected_id = -1;
$Ajax->activate('_page_body');
}
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");
br(2);
-end_page(true, false, false, ST_MANURECEIVE], $wo_production);
+end_page(true, false, false, ST_MANURECEIVE, $wo_production);
?>
'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();
}