From 10fd8252ac45018df5a4aac542f4b9f95ee50bd7 Mon Sep 17 00:00:00 2001 From: Janusz Dobrowolski Date: Tue, 15 Sep 2009 07:23:42 +0000 Subject: [PATCH] Fixed journal entry type and system type lists, code cleanup. --- CHANGELOG.txt | 7 ++++ includes/types.inc | 76 ++++++++++++++++++++++++---------------- includes/ui/ui_lists.inc | 21 ++++------- 3 files changed, 59 insertions(+), 45 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index f1d2169e..0f23316c 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -19,6 +19,13 @@ Legend: ! -> Note $ -> Affected files + +15-Sep-2009 Janusz Dobrowolski +# Fixed journal entry type and systype selectors +$ /includes/types.inc +! Clenaup +$ /includes/ui/ui_lists.inc + 14-Sep-2009 Joe Hunt ! Changed all numeric constants to the new defined constants. A huge task. $ /admin/fiscalyears.php diff --git a/includes/types.inc b/includes/types.inc index 675ecb77..86dd7d72 100644 --- a/includes/types.inc +++ b/includes/types.inc @@ -10,6 +10,8 @@ See the License here . ***********************************************************************/ //---------------------------------------------------------------------------------- +// FrontAccounting system transaction types +// define('ST_JOURNAL', 0); define('ST_BANKPAYMENT', 1); @@ -20,8 +22,10 @@ define('ST_SALESINVOICE', 10); define('ST_CUSTCREDIT', 11); define('ST_CUSTPAYMENT', 12); define('ST_CUSTDELIVERY', 13); + define('ST_LOCTRANSFER', 16); define('ST_INVADJUST', 17); + define('ST_PURCHORDER', 18); define('ST_SUPPINVOICE', 20); define('ST_SUPPCREDIT', 21); @@ -29,15 +33,15 @@ define('ST_SUPPAYMENT', 22); define('ST_SUPPRECEIVE', 25); define('ST_WORKORDER', 26); +define('ST_MANUISSUE', 28); +define('ST_MANURECEIVE', 29); + define('ST_SALESORDER', 30); define('ST_SALESQUOTE', 32); define('ST_COSTUPDATE', 35); define('ST_DIMENSION', 40); -define('ST_MANUISSUE', 28); -define('ST_MANURECEIVE', 29); - $systypes_array = array ( ST_JOURNAL => _("Journal Entry"), ST_BANKPAYMENT => _("Bank Payment"), @@ -64,6 +68,8 @@ $systypes_array = array ( ); //---------------------------------------------------------------------------------- +// Bank transaction types +// define('BT_TRANSFER', 0); define('BT_CHEQUE', 1); define('BT_CREDIT', 2); @@ -84,17 +90,19 @@ $bank_transfer_types = array( ); //---------------------------------------------------------------------------------- -/* Menu tabs */ -$tabs = array('orders'=>_("Sales"), 'AP'=>_("Purchases"), 'stock'=>_("Items and Inventory"), 'manuf'=>_("Manufacturing"), - 'proj'=>_("Dimensions"), 'GL'=>_("Banking and General Ledger"), 'system'=>_("Setup")); +// Core FA menu tabs (modules) +// +$tabs = array('orders'=>_("Sales"), + 'AP'=>_("Purchases"), + 'stock'=>_("Items and Inventory"), + 'manuf'=>_("Manufacturing"), + 'proj'=>_("Dimensions"), + 'GL'=>_("Banking and General Ledger"), + 'system'=>_("Setup")); //---------------------------------------------------------------------------------- - -include_once($path_to_root . "/manufacturing/includes/manufacturing_db.inc"); -include_once($path_to_root . "/purchasing/includes/purchasing_db.inc"); -include_once($path_to_root . "/sales/includes/sales_db.inc"); -include_once($path_to_root . "/dimensions/includes/dimensions_db.inc"); - +// Payment types +// define('PT_MISC', 0); define('PT_WORKORDER', 1); define('PT_CUSTOMER', 2); @@ -110,7 +118,6 @@ $payment_person_types = array ( _("Quick Entry") ); - function payment_person_currency($type, $person_id) { switch ($type) { @@ -174,7 +181,8 @@ function payment_person_has_items($type) { } //---------------------------------------------------------------------------------- - +// Manufacturing types +// define('WO_ASSEMBLY', 0); define('WO_UNASSEMBLY', 1); define('WO_ADVANCED', 2); @@ -185,8 +193,17 @@ $wo_types_array = array ( WO_ADVANCED => _("Advanced Manufacture") ); -//---------------------------------------------------------------------------------- +define('WO_LABOUR', 0); +define('WO_OVERHEAD', 1); +$wo_cost_types = array( + WO_LABOUR => _("Labour Cost"), + WO_OVERHEAD => _("Overhead Cost"), +); + +//---------------------------------------------------------------------------------- +// GL account classes +// define('CL_NONE', 0); // for backward compatibility define('CL_ASSETS', 1); define('CL_LIABILITIES', 2); @@ -212,14 +229,9 @@ function get_class_type_convert($ctype) else return ((($ctype >= CL_LIABILITIES && $ctype <= CL_INCOME) || $ctype == CL_NONE) ? -1 : 1); } -define('WO_LABOUR', 0); -define('WO_OVERHEAD', 1); - -$wo_cost_types = array( - WO_LABOUR => _("Labour Cost"), - WO_OVERHEAD => _("Overhead Cost"), -); - +//---------------------------------------------------------------------------------- +// Quick entry types +// $quick_actions = array( '=' => _('Remainder'), // post current base amount to GL account 'a' => _('Amount'), // post amount to GL account @@ -248,6 +260,16 @@ $quick_entry_types = array( QE_SUPPINV => _("Supplier Invoice/Credit") ); +//---------------------------------------------------------------------------------- +// Special option values for various list selectors. +// +define('ANY_TEXT', ''); +define('ANY_NUMERIC', -1); +define('ALL_TEXT', ''); +define('ALL_NUMERIC', -1); + + +//---------------------------------------------------------------------------------- // Types of stock items $stock_types = array( 'M' => _("Manufactured"), @@ -255,12 +277,4 @@ $stock_types = array( 'D' => _("Service") ); -/* - Special option values for various list selectors. -*/ -define('ANY_TEXT', ''); -define('ANY_NUMERIC', -1); -define('ALL_TEXT', ''); -define('ALL_NUMERIC', -1); - ?> \ No newline at end of file diff --git a/includes/ui/ui_lists.inc b/includes/ui/ui_lists.inc index 913b8a79..ef482505 100644 --- a/includes/ui/ui_lists.inc +++ b/includes/ui/ui_lists.inc @@ -1796,16 +1796,8 @@ function pagesizes_list_row($label, $name, $value=null) function systypes_list_cells($label, $name, $value=null, $submit_on_change=false) { global $systypes_array; - - if ($label != null) - echo "$label\n"; - echo ""; - - $items = array(); - foreach ($systypes_array as $key=>$type) - $items[$key] = $type['name']; - $str = array_selector($name, $value, $items, + $str = array_selector($name, $value, $systypes_array, array( 'select_submit'=> $submit_on_change, 'async' => false @@ -1823,11 +1815,12 @@ function journal_types_list_cells($label, $name, $value=null, $submit_on_change= echo "$label\n"; echo ""; - $items = array(); - foreach ($systypes_array as $key=>$type) - // exclude orders and dimensions - if (!in_array($key, array(18,26,30,40))) - $items[$key] = $type['name']; + $items = $systypes_array; + + // exclude quotes, orders and dimensions + foreach (array(ST_PURCHORDER, ST_WORKORDER, ST_SALESORDER, ST_DIMENSION, + ST_SALESQUOTE) as $excl) + unset($items[$excl]); $str = array_selector($name, $value, $items, array( -- 2.30.2