Added a date column and combined the # and View column in 'View / Print Transactions.
authorJoe Hunt <joe.hunt.consulting@gmail.com>
Thu, 15 Apr 2010 08:50:15 +0000 (08:50 +0000)
committerJoe Hunt <joe.hunt.consulting@gmail.com>
Thu, 15 Apr 2010 08:50:15 +0000 (08:50 +0000)
Changed Voiding Transaction to also include a pager.

CHANGELOG.txt
admin/db/transactions_db.inc
admin/view_print_transaction.php
admin/void_transaction.php
includes/systypes.inc
manufacturing/view/wo_production_view.php
reporting/includes/reporting.inc

index 23f7c4593b8e801d9f004268f09c5c6f3a22e712..9ed47cda5edbdd639720a07ce2f295b2eb11d37d 100644 (file)
@@ -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
index 09814938f1386bf9ed2a2af72d3f0a5c0286fff3..b5ba0cd32032d2a348c88b25bf3b44c89b8b087c 100644 (file)
@@ -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;
 }
index 5a6d5738b8a29578da2f5e8db4d1b4478e1c9e51..7e72bb33aa1e34fa5fd5fba3d7c166b1dd6717ae 100644 (file)
@@ -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')
                );
index 0dcd918d5eb0355c6a8cd4dd682e65ae77a90268..d91c53d0923c470b619dc9f66813f9ed56fdfb73 100644 (file)
 ***********************************************************************/
 $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');
 }
 
index 969960cd3a4c8e11c857c3e54d3b2cbbd6121cc0..1c91abc2e33e6f6aa5dc0e35347b99fe0b397930 100644 (file)
@@ -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");
index e3aa2ef6dc07c216c985e4e8b54e07f3cf093462..985bf64353da0edb0f0474ac8e599105fe9caac9 100644 (file)
@@ -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);
 
 ?>
 
index 2bfa425748808030cf87e4797b27f40260124be3..9491c0c04b799b85bf6aa95f22e2a43e0f74ac3d 100644 (file)
@@ -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();
        }