Added inactive records support.
authorJanusz Dobrowolski <janusz@frontaccounting.eu>
Fri, 24 Apr 2009 16:11:12 +0000 (16:11 +0000)
committerJanusz Dobrowolski <janusz@frontaccounting.eu>
Fri, 24 Apr 2009 16:11:12 +0000 (16:11 +0000)
30 files changed:
admin/payment_terms.php
admin/shipping_companies.php
gl/includes/db/gl_db_account_types.inc
gl/includes/db/gl_db_currencies.inc
gl/manage/bank_accounts.php
gl/manage/currencies.php
gl/manage/gl_account_classes.php
gl/manage/gl_account_types.php
gl/manage/gl_accounts.php
includes/ui/ui_lists.inc
inventory/includes/db/items_units_db.inc
inventory/includes/db/movement_types_db.inc
inventory/manage/item_categories.php
inventory/manage/item_units.php
inventory/manage/items.php
inventory/manage/locations.php
inventory/manage/movement_types.php
manufacturing/includes/db/work_centres_db.inc
manufacturing/manage/work_centres.php
purchasing/manage/suppliers.php
sales/includes/db/sales_points_db.inc
sales/manage/sales_points.php
sql/alter2.2.sql
sql/en_US-demo.sql
sql/en_US-new.sql
taxes/db/tax_groups_db.inc
taxes/db/tax_types_db.inc
taxes/item_tax_types.php
taxes/tax_groups.php
taxes/tax_types.php

index aa76bc157e27cf64c2617b02b8b66d59b2e536f0..ddc4c50945fca768af030f114027629028e7d0fa 100644 (file)
@@ -135,15 +135,20 @@ if ($Mode == 'Delete')
 if ($Mode == 'RESET')
 {
        $selected_id = -1;
+       $sav = get_post('show_inactive');
        unset($_POST);
+       $_POST['show_inactive'] = $sav;
 }
 //-------------------------------------------------------------------------------------------------
 
 $sql = "SELECT * FROM ".TB_PREF."payment_terms";
+if (!check_value('show_inactive')) $sql .= " WHERE !inactive";
 $result = db_query($sql,"could not get payment terms");
+
 start_form();
 start_table($table_style);
 $th = array(_("Description"), _("Following Month On"), _("Due After (Days)"), "", "");
+inactive_control_column($th);
 table_header($th);
 
 $k = 0; //row colour counter
@@ -172,6 +177,7 @@ while ($myrow = db_fetch($result))
     label_cell($myrow["terms"]);
     label_cell($full_text);
     label_cell($after_text);
+       inactive_control_cell($myrow["terms_indicator"], $myrow["inactive"], 'payment_terms', "terms_indicator");
        edit_button_cell("Edit".$myrow["terms_indicator"], _("Edit"));
        delete_button_cell("Delete".$myrow["terms_indicator"], _("Delete"));
     end_row();
@@ -179,14 +185,11 @@ while ($myrow = db_fetch($result))
 
 } //END WHILE LIST LOOP
 
-end_table();
-end_form();
-echo '<br>';
+inactive_control_row($th);
+end_table(1);
 
 //-------------------------------------------------------------------------------------------------
 
-start_form();
-
 start_table($table_style2);
 
 $day_in_following_month = $days_before_due = 0;
index db26a845d1d95efe6e5533f28be62b4bbad6f54e..720c526476affa2efaa25b48e671a591836e9371 100644 (file)
@@ -99,16 +99,21 @@ if ($Mode == 'Delete')
 if ($Mode == 'RESET')
 {
        $selected_id = -1;
+       $sav = get_post('show_inactive');
        unset($_POST);
+       $_POST['show_inactive'] = $sav;
 }
 //----------------------------------------------------------------------------------------------
 
-$sql = "SELECT * FROM ".TB_PREF."shippers ORDER BY shipper_id";
+$sql = "SELECT * FROM ".TB_PREF."shippers";
+if (!check_value('show_inactive')) $sql .= " WHERE !inactive";
+$sql .= " ORDER BY shipper_id";
 $result = db_query($sql,"could not get shippers");
 
 start_form();
 start_table($table_style);
 $th = array(_("Name"), _("Contact Person"), _("Phone Number"), _("Address"), "", "");
+inactive_control_column($th);
 table_header($th);
 
 $k = 0; //row colour counter
@@ -120,19 +125,17 @@ while ($myrow = db_fetch($result))
        label_cell($myrow["contact"]);
        label_cell($myrow["phone"]);
        label_cell($myrow["address"]);
-       edit_button_cell("Edit".$myrow[0], _("Edit"));
-       delete_button_cell("Delete".$myrow[0], _("Delete"));
+       inactive_control_cell($myrow["shipper_id"], $myrow["inactive"], 'shippers', 'shipper_id');
+       edit_button_cell("Edit".$myrow["shipper_id"], _("Edit"));
+       delete_button_cell("Delete".$myrow["shipper_id"], _("Delete"));
        end_row();
 }
 
-end_table();
-end_form();
-echo '<br>';
+inactive_control_row($th);
+end_table(1);
 
 //----------------------------------------------------------------------------------------------
 
-start_form();
-
 start_table($table_style2);
 
 if ($selected_id != -1) 
index 82de20a4a12c9c46f77d18d9df30758e4174121d..d0f2b785a01b75dbbdad755531044d67cb476f70 100644 (file)
@@ -25,9 +25,12 @@ function update_account_type($id, $name, $class_id, $parent)
        db_query($sql, "could not update account type");
 }
 
-function get_account_types()
+function get_account_types($all=false)
 {
-       $sql = "SELECT * FROM ".TB_PREF."chart_types ORDER BY class_id, id";
+       $sql = "SELECT * FROM ".TB_PREF."chart_types";
+
+       if (!$all) $sql .= " WHERE !inactive";
+       $sql .= " ORDER BY class_id, id";
 
        return db_query($sql, "could not get account types");
 }
@@ -75,9 +78,11 @@ function update_account_class($id, $name, $balance, $sign_conv)
        db_query($sql, "could not update account type");
 }
 
-function get_account_classes()
+function get_account_classes($all=false)
 {
-       $sql = "SELECT * FROM ".TB_PREF."chart_class ORDER BY cid";
+       $sql = "SELECT * FROM ".TB_PREF."chart_class";
+       if (!$all) $sql .= " WHERE !inactive";
+       $sql .= " ORDER BY cid";
 
        return db_query($sql, "could not get account types");
 }
index 0c386f8395bd9f923192e8cef9ade0b36dacaa4e..111b83dc8ee67a9612e055054a16a0d095d0ed92 100644 (file)
@@ -53,9 +53,10 @@ function get_currency($curr_code)
 
 //---------------------------------------------------------------------------------------------
 
-function get_currencies()
+function get_currencies($all=false)
 {
        $sql = "SELECT * FROM ".TB_PREF."currencies";
+       if (!$all) $sql .= " WHERE !inactive";
        return db_query($sql, "could not get currencies");
 }
 
index 8b08fae8d59a1455f1e28f78d1ca84c1e064dee4..26fe90d5437ba2da3bea056095c0d654c009732a 100644 (file)
@@ -100,8 +100,9 @@ if ($Mode == 'RESET')
 
 $sql = "SELECT account.*, gl_account.account_name 
        FROM ".TB_PREF."bank_accounts account, ".TB_PREF."chart_master gl_account 
-       WHERE account.account_code = gl_account.account_code"
-       ." ORDER BY account_code, bank_curr_code";
+       WHERE account.account_code = gl_account.account_code";
+if (!check_value('show_inactive')) $sql .= " AND !account.inactive";
+$sql .= " ORDER BY account_code, bank_curr_code";
 
 $result = db_query($sql,"could not get bank accounts");
 
@@ -112,6 +113,7 @@ start_table("$table_style width='80%'");
 
 $th = array(_("Account Name"), _("Type"), _("Currency"), _("GL Account"), 
        _("Bank"), _("Number"), _("Bank Address"),'','');
+inactive_control_column($th);
 table_header($th);     
 
 $k = 0; 
@@ -127,15 +129,14 @@ while ($myrow = db_fetch($result))
     label_cell($myrow["bank_name"], "nowrap");
     label_cell($myrow["bank_account_number"], "nowrap");
     label_cell($myrow["bank_address"]);
+       inactive_control_cell($myrow["id"], $myrow["inactive"], 'bank_accounts', 'id');
        edit_button_cell("Edit".$myrow["id"], _("Edit"));
        delete_button_cell("Delete".$myrow["id"], _("Delete"));
     end_row(); 
 }
 
-end_table();
-end_form();
-echo '<br>';
-start_form();
+inactive_control_row($th);
+end_table(1);
 
 $is_editing = $selected_id != -1; 
 
index 11373fcf3d6c9009c51044528e8a9dae26a8e7ee..2ea60107e55b8573f3e290ab19fe828515af4d50 100644 (file)
@@ -146,13 +146,13 @@ function display_currencies()
 {
        global $table_style;
 
-       $company_currency = get_company_currency();     
+       $company_currency = get_company_currency();
        
-    $result = get_currencies();
-       start_form();    
+    $result = get_currencies(check_value('show_inactive'));
     start_table($table_style);
     $th = array(_("Abbreviation"), _("Symbol"), _("Currency Name"),
        _("Hundredths name"), _("Country"), "", "");
+       inactive_control_column($th);
     table_header($th); 
     
     $k = 0; //row colour counter
@@ -172,6 +172,7 @@ function display_currencies()
                label_cell($myrow["currency"]);
                label_cell($myrow["hundreds_name"]);
                label_cell($myrow["country"]);
+               inactive_control_cell($myrow["curr_abrev"], $myrow["inactive"], 'currencies', 'curr_abrev');
                edit_button_cell("Edit".$myrow["curr_abrev"], _("Edit"));
                if ($myrow["curr_abrev"] != $company_currency)
                        delete_button_cell("Delete".$myrow["curr_abrev"], _("Delete"));
@@ -181,8 +182,8 @@ function display_currencies()
                
     } //END WHILE LIST LOOP
     
+       inactive_control_row($th);
     end_table();
-       end_form();    
     display_note(_("The marked currency is the home currency which cannot be deleted."), 0, 0, "class='currentfg'");
 }
 
@@ -192,7 +193,6 @@ function display_currency_edit($selected_id)
 {
        global $table_style2, $Mode;
        
-       start_form();
        start_table($table_style2);
 
        if ($selected_id != '') 
@@ -224,8 +224,6 @@ function display_currency_edit($selected_id)
        end_table(1);
 
        submit_add_or_update_center($selected_id == '', '', 'both');
-
-       end_form();
 }
 
 //---------------------------------------------------------------------------------------------
@@ -247,10 +245,11 @@ if ($Mode == 'RESET')
                $_POST['hundreds_name']  = '';
 }
 
+start_form();
 display_currencies();
 
 display_currency_edit($selected_id);
-
+end_form();
 //---------------------------------------------------------------------------------------------
 
 end_page();
index f92d5b2589dd35ca83bd96e365d014dce4bb5c01..95eee3701ffbcd29cbb003f89d27322737ebbcb2 100644 (file)
@@ -103,10 +103,12 @@ if ($Mode == 'RESET')
 }
 //-----------------------------------------------------------------------------------
 
-$result = get_account_classes();
+$result = get_account_classes(check_value('show_inactive'));
+
 start_form();
 start_table($table_style);
 $th = array(_("Class ID"), _("Class Name"), _("Balance Sheet"), _("Sign Convert"), "", "");
+inactive_control_column($th);
 table_header($th);
 
 $k = 0;
@@ -135,18 +137,15 @@ while ($myrow = db_fetch($result))
        label_cell($myrow['class_name']);
        label_cell($bs_text);
        label_cell($sc_text);
+       inactive_control_cell($myrow["cid"], $myrow["inactive"], 'chart_class', 'cid');
        edit_button_cell("Edit".$myrow["cid"], _("Edit"));
        delete_button_cell("Delete".$myrow["cid"], _("Delete"));
        end_row();
 }
-
-end_table();
-end_form();
-echo '<br>';
+inactive_control_row($th);
+end_table(1);
 //-----------------------------------------------------------------------------------
 
-start_form();
-
 start_table($table_style2);
 
 if ($selected_id != -1) 
index 2f0529faadc5a8797dfb2453bb2de19c095d02f9..080144c64bad047b8bdc7e7bb26ce22019ab53ca 100644 (file)
@@ -121,10 +121,12 @@ if ($Mode == 'RESET')
 }
 //-----------------------------------------------------------------------------------
 
-$result = get_account_types();
+$result = get_account_types(check_value('show_inactive'));
+
 start_form();
 start_table($table_style);
 $th = array(_("ID"), _("Name"), _("Subgroup Of"), _("Class Type"), "", "");
+inactive_control_column($th);
 table_header($th);
 
 $k = 0;
@@ -148,18 +150,16 @@ while ($myrow = db_fetch($result))
        label_cell($myrow["name"]);
        label_cell($parent_text);
        label_cell($bs_text);
+       inactive_control_cell($myrow["id"], $myrow["inactive"], 'chart_types', 'id');
        edit_button_cell("Edit".$myrow["id"], _("Edit"));
        delete_button_cell("Delete".$myrow["id"], _("Delete"));
        end_row();
 }
 
-end_table();
-end_form();
-echo '<br>';
+inactive_control_row($th);
+end_table(1);
 //-----------------------------------------------------------------------------------
 
-start_form();
-
 start_table($table_style2);
 
 if ($selected_id != -1)
index 459c37667369188fc1438ba54d16315c5daf1a85..c78becaa1605fd725238840aeddb6cec4bcd915e 100644 (file)
@@ -71,12 +71,17 @@ if (isset($_POST['add']) || isset($_POST['update']))
                        $_POST['account_code'] = strtoupper($_POST['account_code']);
        if ($selected_account) 
                {
-               update_gl_account($_POST['account_code'], $_POST['account_name'], $_POST['account_type'], $_POST['account_code2']);
+               update_gl_account($_POST['account_code'], $_POST['account_name'], 
+                               $_POST['account_type'], $_POST['account_code2']);
+                       update_record_status($_POST['account_code'], $_POST['inactive'],
+                               'chart_master', 'account_code');
+                       $Ajax->activate('account_code'); // in case of status change
                        display_notification(_("Account data has been updated."));
                }
        else 
                {
-               add_gl_account($_POST['account_code'], $_POST['account_name'], $_POST['account_type'], $_POST['account_code2']);
+               add_gl_account($_POST['account_code'], $_POST['account_name'], 
+                               $_POST['account_type'], $_POST['account_code2']);
                        $selected_account = $_POST['AccountList'] = $_POST['account_code'];
                        display_notification(_("New account has been added."));
                }
@@ -205,11 +210,17 @@ start_form();
 
 if (db_has_gl_accounts()) 
 {
-       echo "<center>";
-    echo _("Select an Account:") . "&nbsp;";
-    gl_all_accounts_list('AccountList', null, false, false,
-               _('New account'), true);
-    echo "</center>";
+       start_table("class = 'tablestyle_noborder'");
+       start_row();
+    gl_all_accounts_list_cells(null, 'AccountList', null, false, false,
+               _('New account'), true, check_value('show_inactive'));
+       check_cells(_("Show inactive:"), 'show_inactive', null, true);
+       end_row();
+       end_table();
+       if (get_post('_show_inactive_update')) {
+               $Ajax->activate('AccountList');
+               set_focus('AccountList');
+       }
 }
        
 br(1);
@@ -224,6 +235,7 @@ if ($selected_account != "")
        $_POST['account_code2'] = $myrow["account_code2"];
        $_POST['account_name']  = $myrow["account_name"];
        $_POST['account_type'] = $myrow["account_type"];
+       $_POST['inactive'] = $myrow["inactive"];
 
        hidden('account_code', $_POST['account_code']);
        hidden('selected_account', $selected_account);
@@ -234,6 +246,7 @@ else
 {
        $_POST['account_code'] = $_POST['account_code2'] = '';
        $_POST['account_name']  = $_POST['account_type'] = '';
+       $_POST['inactive'] = 0;
        text_row_ex(_("Account Code:"), 'account_code', 11);
 }
 
@@ -243,6 +256,7 @@ text_row_ex(_("Account Name:"), 'account_name', 60);
 
 gl_account_types_list_row(_("Account Group:"), 'account_type', null);
 
+record_status_list_row(_("Account status:"), 'inactive');
 end_table(1);
 
 if ($selected_account == "") 
index 1ef967057fddcb47b096ad48ce8abe83cd2dbaa4..8f10f156f5913bc79bb114506afa9835cb946a2e 100644 (file)
@@ -364,7 +364,8 @@ function _format_add_curr($row)
                '' : ("&nbsp;-&nbsp;" . $row[2]));
 }
 
-function supplier_list($name, $selected_id=null, $spec_option=false, $submit_on_change=false)
+function supplier_list($name, $selected_id=null, $spec_option=false, $submit_on_change=false,
+       $all=false)
 {
        global $all_items;
 
@@ -383,15 +384,17 @@ function supplier_list($name, $selected_id=null, $spec_option=false, $submit_on_
                'select_submit'=> $submit_on_change,
                'async' => false,
                'sel_hint' => $mode ? _('Press Space tab to filter by name fragment') :
-               _('Select supplier')
+               _('Select supplier'),
+               'show_inactive'=>$all
                ));
 }
 
-function supplier_list_cells($label, $name, $selected_id=null, $all_option=false, $submit_on_change=false)
+function supplier_list_cells($label, $name, $selected_id=null, $all_option=false, 
+       $submit_on_change=false, $all=false)
 {
        if ($label != null)
                echo "<td>$label</td><td>\n";
-       $str = supplier_list($name, $selected_id, $all_option, $submit_on_change);
+       $str = supplier_list($name, $selected_id, $all_option, $submit_on_change, $all);
                echo "</td>\n";
        return $str;
 }
@@ -648,7 +651,8 @@ function dimensions_list_row($label, $name, $selected_id=null, $no_option=false,
 
 //---------------------------------------------------------------------------------------------------
 
-function stock_items_list($name, $selected_id=null, $all_option=false, $submit_on_change=false, $opts=array())
+function stock_items_list($name, $selected_id=null, $all_option=false, 
+       $submit_on_change=false, $opts=array())
 {
        global $all_items;
 
@@ -676,12 +680,13 @@ function _format_stock_items($row)
        return (user_show_codes() ?  ($row[0] . "&nbsp;-&nbsp;") : "") . $row[1];
 }
 
-function stock_items_list_cells($label, $name, $selected_id=null, $all_option=false, $submit_on_change=false)
+function stock_items_list_cells($label, $name, $selected_id=null, $all_option=false, 
+       $submit_on_change=false, $all=false)
 {
        if ($label != null)
                echo "<td>$label</td>\n";
        $str = stock_items_list($name, $selected_id, $all_option, $submit_on_change,
-               array('cells'=>true));
+               array('cells'=>true, 'show_inactive'=>$all));
        return $str;
 }
 /*
@@ -715,7 +720,7 @@ function sales_items_list($name, $selected_id=null, $all_option=false,
        } elseif ($type == 'kits') { // sales kits
                $sql .= " WHERE !i.is_foreign AND i.item_code!=i.stock_id";
        }
-                               
+       $sql .= " AND !i.inactive";
        $sql .= " GROUP BY i.item_code";
 
        return combo_input($name, $selected_id, $sql, 'i.item_code', 'c.description',
@@ -879,16 +884,17 @@ function stock_costable_items_list_cells($label, $name, $selected_id=null,
 
 //------------------------------------------------------------------------------------
 function stock_purchasable_items_list($name, $selected_id=null,        
-       $all_option=false, $submit_on_change=false)
+       $all_option=false, $submit_on_change=false, $all=false)
 {
        $str = stock_items_list($name, $selected_id, $all_option, $submit_on_change,
                array('where'=>array("mb_flag!= 'M'"), 
-                       'edit_submit' => true));
+                       'edit_submit' => true,
+                       'show_inactive'=>$all));
        return $str;
 }
 
 function stock_purchasable_items_list_cells($label, $name, $selected_id=null,
-                       $all_option=false, $submit_on_change=false)
+                       $all_option=false, $submit_on_change=false, $all=false)
 {
        if ($label != null)
                echo "<td>$label</td>\n";
@@ -1556,7 +1562,7 @@ function gl_account_types_list_row($label, $name, $selected_id=null, $all_option
 
 //-----------------------------------------------------------------------------------------------
 function gl_all_accounts_list($name, $selected_id=null, $skip_bank_accounts=false,
-       $cells=false, $all_option=false, $submit_on_change=false)
+       $cells=false, $all_option=false, $submit_on_change=false, $all=false)
 {
        if ($skip_bank_accounts)
                $sql = "SELECT chart.account_code, chart.account_name, type.name, chart.inactive
@@ -1583,7 +1589,8 @@ function gl_all_accounts_list($name, $selected_id=null, $skip_bank_accounts=fals
                        'cells' => true,
                'select_submit'=> $submit_on_change,
                'async' => false,
-               'category' => 2
+               'category' => 2,
+               'show_inactive' => $all
        ) );
 
 }
@@ -1594,13 +1601,14 @@ function _format_account($row)
 }
 
 function gl_all_accounts_list_cells($label, $name, $selected_id=null, 
-       $skip_bank_accounts=false, $cells=false, $all_option=false)
+       $skip_bank_accounts=false, $cells=false, $all_option=false, 
+       $submit_on_change=false, $all=false)
 {
        if ($label != null)
                echo "<td>$label</td>\n";
        echo "<td>";
        gl_all_accounts_list($name, $selected_id, 
-               $skip_bank_accounts, $cells, $all_option);
+               $skip_bank_accounts, $cells, $all_option, $submit_on_change, $all);
        echo "</td>\n";
 }
 
index 2d23210273e8ddafe98d3177f17f5d5884651c03..b5c98d9118f7afd5f39d2fcc0f9754618e16a9ed 100644 (file)
@@ -58,8 +58,10 @@ function item_unit_used($unit) {
        return ($myrow[0] > 0);
 }
 
-function get_all_item_units() {
-    $sql = "SELECT * FROM ".TB_PREF."item_units ORDER BY name";
+function get_all_item_units($all=false) {
+    $sql = "SELECT * FROM ".TB_PREF."item_units";
+       if (!$all) $sql .= " WHERE !inactive";
+       $sql .= " ORDER BY name";
     return  db_query($sql, "could not get stock categories");
 }
 // 2008-06-15. Added Joe Hunt to get a measure of unit by given stock_id
index 78e55a9705b0e5054f31fe10104392a0e5e1e073..41fd14acc4cdc0f5c0be3629963657d2d2d5e507 100644 (file)
@@ -25,9 +25,10 @@ function update_movement_type($type_id, $name)
        db_query($sql, "could not update item movement type");
 }
 
-function get_all_movement_type()
+function get_all_movement_type($all=false)
 {
        $sql = "SELECT * FROM ".TB_PREF."movement_types";
+       if (!$all) $sql .= " WHERE !inactive";
 
        return db_query($sql, "could not get all item movement type");
 }
@@ -35,7 +36,6 @@ function get_all_movement_type()
 function get_movement_type($type_id)
 {
        $sql = "SELECT * FROM ".TB_PREF."movement_types WHERE id=$type_id";
-
        $result = db_query($sql, "could not get item movement type");
 
        return db_fetch($result);
index b5ded413293931fc278b64717aa9045ebd01208c..78c21944d49f1a7c824d87eab58b749b758567d8 100644 (file)
@@ -84,7 +84,9 @@ if ($Mode == 'Delete')
 if ($Mode == 'RESET')
 {
        $selected_id = -1;
+       $sav = get_post('show_inactive');
        unset($_POST);
+       $_POST['show_inactive'] = $sav;
 }
 if (list_updated('mb_flag')) {
        $Ajax->activate('details');
@@ -93,6 +95,7 @@ if (list_updated('mb_flag')) {
 
 $sql = "SELECT c.*, t.name as tax_name FROM ".TB_PREF."stock_category c, "
        .TB_PREF."item_tax_types t WHERE c.dflt_tax_type=t.id";
+if (!check_value('show_inactive')) $sql .= " AND !inactive";
 
 $result = db_query($sql, "could not get stock categories");
 
@@ -101,6 +104,8 @@ start_table("$table_style width=80%");
 $th = array(_("Name"), _("Tax type"), _("Units"), _("Type"), _("Sales Act"),
 _("COGS Account"), _("Inventory Account"), _("Adjustment Account"),
 _("Assembly Account"), "", "");
+inactive_control_column($th);
+
 table_header($th);
 $k = 0; //row colour counter
 
@@ -118,18 +123,17 @@ while ($myrow = db_fetch($result))
        label_cell($myrow["dflt_inventory_act"], "align=center");
        label_cell($myrow["dflt_adjustment_act"], "align=center");
        label_cell($myrow["dflt_assembly_act"], "align=center");
-       edit_button_cell("Edit".$myrow[0], _("Edit"));
-       delete_button_cell("Delete".$myrow[0], _("Delete"));
+       inactive_control_cell($myrow["category_id"], $myrow["inactive"], 'stock_category', 'category_id');
+       edit_button_cell("Edit".$myrow["category_id"], _("Edit"));
+       delete_button_cell("Delete".$myrow["category_id"], _("Delete"));
        end_row();
 }
 
+inactive_control_row($th);
 end_table();
-end_form();
 echo '<br>';
 //----------------------------------------------------------------------------------
 
-start_form();
-
 div_start('details');
 start_table($table_style2);
 
index de6154a6e5af904024a93b8c6c29c2b5af9e4b87..64ad4deeaf2b978e451ee4e131a14c2604ab82dd 100644 (file)
@@ -74,15 +74,19 @@ if ($Mode == 'Delete')
 if ($Mode == 'RESET')
 {
        $selected_id = '';
+       $sav = get_post('show_inactive');
        unset($_POST);
+       $_POST['show_inactive'] = $sav;
 }
 
 //----------------------------------------------------------------------------------
 
-$result = get_all_item_units();
+$result = get_all_item_units(check_value('show_inactive'));
+
 start_form();
 start_table("$table_style width=40%");
 $th = array(_('Unit'), _('Description'), _('Decimals'), "", "");
+inactive_control_column($th);
 
 table_header($th);
 $k = 0; //row colour counter
@@ -96,19 +100,17 @@ while ($myrow = db_fetch($result))
        label_cell($myrow["name"]);
        label_cell(($myrow["decimals"]==-1?_("User Quantity Decimals"):$myrow["decimals"]));
 
-       edit_button_cell("Edit".$myrow[0], _("Edit"));
-       delete_button_cell("Delete".$myrow[0], _("Delete"));
+       inactive_control_cell($myrow["abbr"], $myrow["inactive"], 'item_units', 'abbr');
+       edit_button_cell("Edit".$myrow["abbr"], _("Edit"));
+       delete_button_cell("Delete".$myrow["abbr"], _("Delete"));
        end_row();
 }
 
-end_table();
-end_form();
-echo '<br>';
+inactive_control_row($th);
+end_table(1);
 
 //----------------------------------------------------------------------------------
 
-start_form();
-
 start_table($table_style2);
 
 if ($selected_id != '') 
index 5dbbf556af68c71a4d54da8f5a35f18de89ee53e..a88c97946f467cd149c03d86940ee4ad7dd66bb8 100644 (file)
@@ -168,7 +168,11 @@ if (isset($_POST['addupdate']))
                                $_POST['sales_account'], $_POST['inventory_account'], $_POST['cogs_account'],
                                $_POST['adjustment_account'], $_POST['assembly_account'], 
                                $_POST['dimension_id'], $_POST['dimension2_id']);
-
+                       update_record_status($_POST['NewStockID'], $_POST['inactive'],
+                               'stock_master', 'stock_id');
+                       update_record_status($_POST['NewStockID'], $_POST['inactive'],
+                               'item_codes', 'item_code');
+                       $Ajax->activate('stock_id'); // in case of status change
                        display_notification(_("Item has been updated."));
                } 
                else 
@@ -284,10 +288,16 @@ if (db_has_stock_items())
        start_table("class='tablestyle_noborder'");
        start_row();
     stock_items_list_cells(_("Select an item:"), 'stock_id', null,
-         _('New item'), true);
+         _('New item'), true, check_value('show_inactive'));
        $new_item = get_post('stock_id')==''; 
+       check_cells(_("Show inactive:"), 'show_inactive', null, true);
        end_row();
        end_table();
+
+       if (get_post('_show_inactive_update')) {
+               $Ajax->activate('stock_id');
+               set_focus('stock_id');
+       }
 }
 
 div_start('details');
@@ -302,6 +312,7 @@ table_section_title(_("Item"));
 if ($new_item) 
 {
        text_row(_("Item Code:"), 'NewStockID', null, 21, 20);
+       $_POST['inactive'] = 0;
 } 
 else 
 { // Must be modifying an existing item
@@ -324,6 +335,7 @@ else
                $_POST['dimension_id']  = $myrow['dimension_id'];
                $_POST['dimension2_id'] = $myrow['dimension2_id'];
                $_POST['del_image'] = 0;        
+               $_POST['inactive'] = $myrow["inactive"];
                label_row(_("Item Code:"),$_POST['NewStockID']);
                hidden('NewStockID', $_POST['NewStockID']);
                set_focus('description');
@@ -423,6 +435,7 @@ label_row("&nbsp;", $stock_img_link);
 if ($check_remove_image)
        check_row(_("Delete Image:"), 'del_image', $_POST['del_image']);
        
+record_status_list_row(_("Item status:"), 'inactive');
 end_outer_table(1);
 div_end();
 div_start('controls');
index bf36ac413d6d30931b6ce7d15734123aab5e83fc..4fdef13119df1bddd13d34c46a42d6da300603ca 100644 (file)
@@ -117,39 +117,41 @@ if ($Mode == 'Delete')
 if ($Mode == 'RESET')
 {
        $selected_id = -1;
+       $sav = get_post('show_inactive');
        unset($_POST);
+       $_POST['show_inactive'] = $sav;
 }
 
 $sql = "SELECT * FROM ".TB_PREF."locations";
+if (!check_value('show_inactive')) $sql .= " WHERE !inactive";
 $result = db_query($sql, "could not query locations");;
 
 start_form();
 start_table("$table_style width=30%");
-$th = array(_("Location Code"), _("Location Name"), "", "");
+$th = array(_("Location Code"), _("Location Name"), _("Address"), _("Phone"), "", "");
+inactive_control_column($th);
 table_header($th);
 $k = 0; //row colour counter
-while ($myrow = db_fetch_row($result)) 
+while ($myrow = db_fetch($result)) 
 {
 
        alt_table_row_color($k);
        
-       label_cell($myrow[0]);
-       label_cell($myrow[1]);
-       edit_button_cell("Edit".$myrow[0], _("Edit"));
-       delete_button_cell("Delete".$myrow[0], _("Delete"));
+       label_cell($myrow["loc_code"]);
+       label_cell($myrow["location_name"]);
+       label_cell($myrow["delivery_address"]);
+       label_cell($myrow["phone"]);
+       inactive_control_cell($myrow["loc_code"], $myrow["inactive"], 'locations', 'loc_code');
+       edit_button_cell("Edit".$myrow["loc_code"], _("Edit"));
+       delete_button_cell("Delete".$myrow["loc_code"], _("Delete"));
        end_row();
 }
        //END WHILE LIST LOOP
-
-//end of ifs and buts!
-
+inactive_control_row($th);
 end_table();
 
-end_form();
 echo '<br>';
 
-start_form();
-
 start_table($table_style2);
 
 $_POST['email'] = "";
index 3e5d0602c84eb04bc854eff625e952df40702fe7..aacdda94d01912b58172c9e4098ac47671ffd777 100644 (file)
@@ -85,16 +85,19 @@ if ($Mode == 'Delete')
 if ($Mode == 'RESET')
 {
        $selected_id = -1;
+       $sav = get_post('show_inactive');
        unset($_POST);
+       $_POST['show_inactive'] = $sav;
 }
 //-----------------------------------------------------------------------------------
 
-$result = get_all_movement_type();
+$result = get_all_movement_type(check_value('show_inactive'));
 
 start_form();
 start_table("$table_style width=30%");
 
 $th = array(_("Description"), "", "");
+inactive_control_column($th);
 table_header($th);
 $k = 0;
 while ($myrow = db_fetch($result)) 
@@ -103,19 +106,16 @@ while ($myrow = db_fetch($result))
        alt_table_row_color($k);        
 
        label_cell($myrow["name"]);
+       inactive_control_cell($myrow["id"], $myrow["inactive"], 'movement_types', 'id');
        edit_button_cell("Edit".$myrow['id'], _("Edit"));
        delete_button_cell("Delete".$myrow['id'], _("Delete"));
        end_row();
 }
-
-end_table();
-end_form();
-echo '<br>';
+inactive_control_row($th);
+end_table(1);
 
 //-----------------------------------------------------------------------------------
 
-start_form();
-
 start_table($table_style2);
 
 if ($selected_id != -1) 
index c01ad50f410e4987fe7c6705bcb55ed02897ef8b..e1b8a023a63b112ef8b85a85dba71253f83cf3f2 100644 (file)
@@ -25,9 +25,10 @@ function update_work_centre($type_id, $name, $description)
        db_query($sql, "could not update work centre");
 }
 
-function get_all_work_centres()
+function get_all_work_centres($all=false)
 {
        $sql = "SELECT * FROM ".TB_PREF."workcentres";
+       if (!$all) $sql .= " WHERE !inactive";
 
        return db_query($sql, "could not get all work centres");
 }
index 116e4fec0605a1c2a8f656f6e2b9978bb917903e..769d1b4b04c40f91ac6c53563ea5bd3237f82687 100644 (file)
@@ -94,15 +94,18 @@ if ($Mode == 'Delete')
 if ($Mode == 'RESET')
 {
        $selected_id = -1;
+       $sav = get_post('show_inactive');
        unset($_POST);
+       $_POST['show_inactive'] = $sav;
 }
 //-----------------------------------------------------------------------------------
 
-$result = get_all_work_centres();
+$result = get_all_work_centres(check_value('show_inactive'));
 
 start_form();
 start_table("$table_style width=50%");
 $th = array(_("Name"), _("description"), "", "");
+inactive_control_column($th);
 table_header($th);
 
 $k = 0;
@@ -113,18 +116,16 @@ while ($myrow = db_fetch($result))
 
        label_cell($myrow["name"]);
        label_cell($myrow["description"]);
+       inactive_control_cell($myrow["id"], $myrow["inactive"], 'workcentres', 'id');
        edit_button_cell("Edit".$myrow['id'], _("Edit"));
        delete_button_cell("Delete".$myrow['id'], _("Delete"));
        end_row();
 }
 
-end_table();
-end_form();
-echo '<br>';
+inactive_control_row($th);
+end_table(1);
 //-----------------------------------------------------------------------------------
 
-start_form();
-
 start_table($table_style2);
 
 if ($selected_id != -1) 
index 78dbfdb10ada6e88aab5fee83c681d619832b525..0df75281dbe0561fcd39395dd1338b0222c3c836 100644 (file)
@@ -74,6 +74,10 @@ if (isset($_POST['submit']))
                                tax_group_id=".db_escape($_POST['tax_group_id']) . " WHERE supplier_id = '" . $_POST['supplier_id'] . "'";
 
                        db_query($sql,"The supplier could not be updated");
+                       update_record_status($_POST['supplier_id'], $_POST['inactive'],
+                               'suppliers', 'supplier_id');
+
+                       $Ajax->activate('supplier_id'); // in case of status change
                        display_notification(_("Supplier has been updated."));
                } 
                else 
@@ -163,9 +167,16 @@ if (db_has_suppliers())
 {
        start_table("", 3);
 //     start_table("class = 'tablestyle_noborder'");
-       supplier_list_row(_("Select a supplier: "), 'supplier_id', null,
-                 _('New supplier'), true);
+       start_row();
+       supplier_list_cells(_("Select a supplier: "), 'supplier_id', null,
+                 _('New supplier'), true, check_value('show_inactive'));
+       check_cells(_("Show inactive:"), 'show_inactive', null, true);
+       end_row();
        end_table();
+       if (get_post('_show_inactive_update')) {
+               $Ajax->activate('supplier_id');
+               set_focus('supplier_id');
+       }
 } 
 else 
 {
@@ -202,7 +213,7 @@ if (!$new_supplier)
        $_POST['purchase_account']  = $myrow["purchase_account"];
        $_POST['payment_discount_account'] = $myrow["payment_discount_account"];
        $_POST['notes']  = $myrow["notes"];
-
+       $_POST['inactive'] = $myrow["inactive"];
 } 
 else 
 {
@@ -220,6 +231,7 @@ else
        $_POST['payable_account'] = $company_record["creditors_act"];
        $_POST['purchase_account'] = $company_record["default_cogs_act"];
        $_POST['payment_discount_account'] = $company_record['pyt_discount_act'];
+       $_POST['inactive'] = 0;
 }
 
 table_section_title(_("Name and Contact"));
@@ -281,6 +293,7 @@ if ($dim < 2)
        hidden('dimension2_id', 0);
 table_section_title(_("General"));
 textarea_row(_("General Notes:"), 'notes', null, 35, 5);
+record_status_list_row(_("Supplier status:"), 'inactive');
 
 end_outer_table(1);
 
index 9feae5aa7846d2866fb6d85bce957b8a4bb1af9e..35d220dd7bb0c4f8c27de9499c776dcf25d41014 100644 (file)
@@ -30,12 +30,13 @@ function update_sales_point($id, $name, $location, $account, $cash, $credit)
        db_query($sql, "could not update sales type");                  
 }
 
-function get_all_sales_points()
+function get_all_sales_points($all=false)
 {
        $sql = "SELECT pos.*, loc.location_name, acc.bank_account_name FROM "
                .TB_PREF."sales_pos as pos
                LEFT JOIN ".TB_PREF."locations as loc on pos.pos_location=loc.loc_code
                LEFT JOIN ".TB_PREF."bank_accounts as acc on pos.pos_account=acc.id";
+       if (!$all) $sql .= " WHERE !pos.inactive";
        
        return db_query($sql, "could not get all POS definitions");
 } 
index b7f292defb58532065020402efb99fb7bb1faecb..6282cf7f6d5e5c2fc3ab2679338284d06bbaeb62 100644 (file)
@@ -72,17 +72,20 @@ if ($Mode == 'Delete')
 if ($Mode == 'RESET')
 {
        $selected_id = -1;
+       $sav = get_post('show_inactive');
        unset($_POST);
+       $_POST['show_inactive'] = $sav;
 }
 //----------------------------------------------------------------------------------------------------
 
-$result = get_all_sales_points();
+$result = get_all_sales_points(check_value('show_inactive'));
 
 start_form();
 start_table("$table_style");
 
 $th = array (_('POS Name'), _('Credit sale'), _('Cash sale'), _('Location'), _('Default account'), 
         '','');
+inactive_control_column($th);
 table_header($th);
 $k = 0;
 
@@ -94,18 +97,16 @@ while ($myrow = db_fetch($result))
        label_cell($myrow['cash_sale'] ? _('Yes') : _('No'));
        label_cell($myrow["location_name"], "");
        label_cell($myrow["bank_account_name"], "");
+       inactive_control_cell($myrow["id"], $myrow["inactive"], "sales_pos", 'id');
        edit_button_cell("Edit".$myrow['id'], _("Edit"));
        delete_button_cell("Delete".$myrow['id'], _("Delete"));
        end_row();
 }
 
-end_table();
-end_form();
-echo '<br>';
+inactive_control_row($th);
+end_table(1);
 //----------------------------------------------------------------------------------------------------
 
-start_form();
-
 $cash = db_has_cash_accounts();
 
 if (!$cash) display_note(_("To have cash POS first define at least one cash bank account."));
index 33df45e0377c89d43cbaf1a60e33a841b9ab7b15..b0a9173ea90f3d8d3caa3079b5a4cc46e9b90e97 100644 (file)
@@ -23,9 +23,17 @@ ALTER TABLE `0_stock_category` ADD COLUMN `dflt_assembly_act` varchar(11) NOT NU
 ALTER TABLE `0_stock_category` ADD COLUMN `dflt_dim1` int(11) default NULL;
 ALTER TABLE `0_stock_category` ADD COLUMN `dflt_dim2` int(11) default NULL;
 
-ALTER TABLE `0_users` ADD `sticky_doc_date` TINYINT(1) DEFAULT '0';
+ALTER TABLE `0_users` ADD COLUMN `sticky_doc_date` TINYINT(1) DEFAULT '0';
 
 ALTER TABLE `0_debtors_master` MODIFY COLUMN `name` varchar(100) NOT NULL default '';
-ALTER TABLE `0_cust_branch` ADD `inactive` tinyint(1) NOT NULL default '0';
-ALTER TABLE `0_chart_class` ADD `sign_convert` tinyint(1) NOT NULL default '0';
-UPDATE `0_chart_class` SET sign_convert=1 WHERE cid=3 OR cid=4 OR cid=5;
+ALTER TABLE `0_cust_branch` ADD COLUMN `inactive` tinyint(1) NOT NULL default '0';
+
+ALTER TABLE `0_chart_class` ADD COLUMN `sign_convert` tinyint(1) NOT NULL default '0';
+UPDATE `0_chart_class` SET `sign_convert`=1 WHERE `cid`=3 OR `cid`=4 OR `cid`=5;
+
+ALTER TABLE `0_chart_class` ADD COLUMN `inactive` tinyint(1) NOT NULL default '0';
+ALTER TABLE `0_chart_types` ADD COLUMN `inactive` tinyint(1) NOT NULL default '0';
+ALTER TABLE `0_movement_types` ADD COLUMN `inactive` tinyint(1) NOT NULL default '0';
+ALTER TABLE `0_item_tax_types` ADD COLUMN `inactive` tinyint(1) NOT NULL default '0';
+ALTER TABLE `0_tax_types` ADD COLUMN `inactive` tinyint(1) NOT NULL default '0';
+ALTER TABLE `0_tax_groups` ADD COLUMN `inactive` tinyint(1) NOT NULL default '0';
index 0d2cc25a2e77e31f618b15a569c3803b5aa62e34..b3544add06f4595bbcf0ba1ad1af6e9a73eed8f6 100644 (file)
@@ -180,17 +180,19 @@ CREATE TABLE `0_chart_class` (
   `cid` int(11) NOT NULL default '0',
   `class_name` varchar(60) NOT NULL default '',
   `balance_sheet` tinyint(1) NOT NULL default '0',
+  `sign_convert` tinyint(1) NOT NULL default '0',
+  `inactive` tinyint(1) NOT NULL default '0',
   PRIMARY KEY  (`cid`)
 ) TYPE=MyISAM  ;
 
 
 ### Data of table `0_chart_class` ###
 
-INSERT INTO `0_chart_class` VALUES ('1', 'Assets', '1');
-INSERT INTO `0_chart_class` VALUES ('2', 'Liabilities', '1');
-INSERT INTO `0_chart_class` VALUES ('3', 'Income', '0');
-INSERT INTO `0_chart_class` VALUES ('4', 'Costs', '0');
-INSERT INTO `0_chart_class` VALUES ('5', 'Gross', '0');
+INSERT INTO `0_chart_class` VALUES ('1', 'Assets', '1', '0', '0');
+INSERT INTO `0_chart_class` VALUES ('2', 'Liabilities', '1', '0', '0');
+INSERT INTO `0_chart_class` VALUES ('3', 'Income', '0', '1', '0');
+INSERT INTO `0_chart_class` VALUES ('4', 'Costs', '0', '1', '0');
+INSERT INTO `0_chart_class` VALUES ('5', 'Gross', '0', '1', '0');
 
 
 ### Structure of table `0_chart_master` ###
@@ -267,6 +269,7 @@ CREATE TABLE `0_chart_types` (
   `name` varchar(60) NOT NULL default '',
   `class_id` tinyint(1) NOT NULL default '0',
   `parent` int(11) NOT NULL default '-1',
+  `inactive` tinyint(1) NOT NULL default '0',
   PRIMARY KEY  (`id`),
   KEY `name` (`name`)
 ) TYPE=MyISAM AUTO_INCREMENT=53  AUTO_INCREMENT=53 ;
@@ -274,17 +277,17 @@ CREATE TABLE `0_chart_types` (
 
 ### Data of table `0_chart_types` ###
 
-INSERT INTO `0_chart_types` VALUES ('1', 'Sales', '3', '-1');
-INSERT INTO `0_chart_types` VALUES ('2', 'Cost of Sales', '4', '-1');
-INSERT INTO `0_chart_types` VALUES ('5', 'Expenses', '4', '-1');
-INSERT INTO `0_chart_types` VALUES ('10', 'Cash/Bank', '1', '-1');
-INSERT INTO `0_chart_types` VALUES ('20', 'Accounts Receivable', '1', '-1');
-INSERT INTO `0_chart_types` VALUES ('30', 'Accounts Payable', '2', '-1');
-INSERT INTO `0_chart_types` VALUES ('40', 'Fixed Assets', '1', '-1');
-INSERT INTO `0_chart_types` VALUES ('45', 'Inventory', '1', '-1');
-INSERT INTO `0_chart_types` VALUES ('50', 'Equity', '2', '-1');
-INSERT INTO `0_chart_types` VALUES ('51', 'Depreciations', '4', '-1');
-INSERT INTO `0_chart_types` VALUES ('52', 'Financials', '4', '-1');
+INSERT INTO `0_chart_types` VALUES ('1', 'Sales', '3', '-1', '0');
+INSERT INTO `0_chart_types` VALUES ('2', 'Cost of Sales', '4', '-1', '0');
+INSERT INTO `0_chart_types` VALUES ('5', 'Expenses', '4', '-1', '0');
+INSERT INTO `0_chart_types` VALUES ('10', 'Cash/Bank', '1', '-1', '0');
+INSERT INTO `0_chart_types` VALUES ('20', 'Accounts Receivable', '1', '-1', '0');
+INSERT INTO `0_chart_types` VALUES ('30', 'Accounts Payable', '2', '-1', '0');
+INSERT INTO `0_chart_types` VALUES ('40', 'Fixed Assets', '1', '-1', '0');
+INSERT INTO `0_chart_types` VALUES ('45', 'Inventory', '1', '-1', '0');
+INSERT INTO `0_chart_types` VALUES ('50', 'Equity', '2', '-1', '0');
+INSERT INTO `0_chart_types` VALUES ('51', 'Depreciations', '4', '-1', '0');
+INSERT INTO `0_chart_types` VALUES ('52', 'Financials', '4', '-1', '0');
 
 
 ### Structure of table `0_comments` ###
@@ -1146,8 +1149,9 @@ DROP TABLE IF EXISTS `0_item_tax_types`;
 
 CREATE TABLE `0_item_tax_types` (
   `id` int(11) NOT NULL auto_increment,
-  `name` varchar(60) NOT NULL default '',
+  `name` varchar(60) [BNOT NULL default '',
   `exempt` tinyint(1) NOT NULL default '0',
+  `inactive` tinyint(1) NOT NULL default '0',
   PRIMARY KEY  (`id`),
   UNIQUE KEY `name` (`name`)
 ) TYPE=InnoDB AUTO_INCREMENT=3  AUTO_INCREMENT=3 ;
@@ -1156,7 +1160,7 @@ CREATE TABLE `0_item_tax_types` (
 ### Data of table `0_item_tax_types` ###
 
 INSERT INTO `0_item_tax_types` VALUES ('1', 'Regular', '0');
-INSERT INTO `0_item_tax_types` VALUES ('2', 'Recovery equipment', '0');
+INSERT INTO `0_item_tax_types` VALUES ('2', 'Recovery equipment', '0', '0');
 
 
 ### Structure of table `0_item_units` ###
@@ -1248,6 +1252,7 @@ DROP TABLE IF EXISTS `0_movement_types`;
 CREATE TABLE `0_movement_types` (
   `id` int(11) NOT NULL auto_increment,
   `name` varchar(60) NOT NULL default '',
+  `inactive` tinyint(1) NOT NULL default '0',
   PRIMARY KEY  (`id`),
   UNIQUE KEY `name` (`name`)
 ) TYPE=MyISAM AUTO_INCREMENT=2  AUTO_INCREMENT=2 ;
@@ -1255,7 +1260,7 @@ CREATE TABLE `0_movement_types` (
 
 ### Data of table `0_movement_types` ###
 
-INSERT INTO `0_movement_types` VALUES ('1', 'Adjustment');
+INSERT INTO `0_movement_types` VALUES ('1', 'Adjustment', '0');
 
 
 ### Structure of table `0_payment_terms` ###
@@ -2119,6 +2124,7 @@ CREATE TABLE `0_tax_groups` (
   `id` int(11) NOT NULL auto_increment,
   `name` varchar(60) NOT NULL default '',
   `tax_shipping` tinyint(1) NOT NULL default '0',
+  `inactive` tinyint(1) NOT NULL default '0',
   PRIMARY KEY  (`id`),
   UNIQUE KEY `name` (`name`)
 ) TYPE=InnoDB AUTO_INCREMENT=6  AUTO_INCREMENT=6 ;
@@ -2126,10 +2132,10 @@ CREATE TABLE `0_tax_groups` (
 
 ### Data of table `0_tax_groups` ###
 
-INSERT INTO `0_tax_groups` VALUES ('1', 'VAT', '0');
-INSERT INTO `0_tax_groups` VALUES ('2', 'Tax-Free', '0');
-INSERT INTO `0_tax_groups` VALUES ('4', 'Shipping', '1');
-INSERT INTO `0_tax_groups` VALUES ('5', 'Export', '0');
+INSERT INTO `0_tax_groups` VALUES ('1', 'VAT', '0', '0');
+INSERT INTO `0_tax_groups` VALUES ('2', 'Tax-Free', '0', '0');
+INSERT INTO `0_tax_groups` VALUES ('4', 'Shipping', '1', '0');
+INSERT INTO `0_tax_groups` VALUES ('5', 'Export', '0', '0');
 
 
 ### Structure of table `0_tax_types` ###
@@ -2142,16 +2148,17 @@ CREATE TABLE `0_tax_types` (
   `sales_gl_code` varchar(11) NOT NULL default '',
   `purchasing_gl_code` varchar(11) NOT NULL default '',
   `name` varchar(60) NOT NULL default '',
+  `inactive` tinyint(1) NOT NULL default '0',
   PRIMARY KEY  (`id`)
 ) TYPE=InnoDB AUTO_INCREMENT=5  AUTO_INCREMENT=5 ;
 
 
 ### Data of table `0_tax_types` ###
 
-INSERT INTO `0_tax_types` VALUES ('1', '5', '2660', '2680', 'VAT');
-INSERT INTO `0_tax_types` VALUES ('2', '1', '2662', '2680', 'Manufact tax 1');
-INSERT INTO `0_tax_types` VALUES ('3', '25', '2664', '2682', 'VAT');
-INSERT INTO `0_tax_types` VALUES ('4', '0', '2660', '2680', 'Export');
+INSERT INTO `0_tax_types` VALUES ('1', '5', '2660', '2680', 'VAT', '0');
+INSERT INTO `0_tax_types` VALUES ('2', '1', '2662', '2680', 'Manufact tax 1', '0');
+INSERT INTO `0_tax_types` VALUES ('3', '25', '2664', '2682', 'VAT', '0');
+INSERT INTO `0_tax_types` VALUES ('4', '0', '2660', '2680', 'Export', '0');
 
 
 ### Structure of table `0_trans_tax_details` ###
index 255e2a520e5a9f37569db25f766c5a64813db4fc..5c166546543c9b253d5ddbf302592904bf2327dd 100644 (file)
@@ -161,16 +161,18 @@ CREATE TABLE `0_chart_class` (
   `cid` int(11) NOT NULL default '0',
   `class_name` varchar(60) NOT NULL default '',
   `balance_sheet` tinyint(1) NOT NULL default '0',
+  `sign_convert` tinyint(1) NOT NULL default '0',
+  `inactive` tinyint(1) NOT NULL default '0',
   PRIMARY KEY  (`cid`)
 ) TYPE=MyISAM  ;
 
 
 ### Data of table `0_chart_class` ###
 
-INSERT INTO `0_chart_class` VALUES ('1', 'Assets', '1');
-INSERT INTO `0_chart_class` VALUES ('2', 'Liabilities', '1');
-INSERT INTO `0_chart_class` VALUES ('3', 'Income', '0');
-INSERT INTO `0_chart_class` VALUES ('4', 'Costs', '0');
+INSERT INTO `0_chart_class` VALUES ('1', 'Assets', '1', '0', '0');
+INSERT INTO `0_chart_class` VALUES ('2', 'Liabilities', '1', '1', '0');
+INSERT INTO `0_chart_class` VALUES ('3', 'Income', '0', '1', '0');
+INSERT INTO `0_chart_class` VALUES ('4', 'Costs', '0', '1', '0');
 
 
 ### Structure of table `0_chart_master` ###
@@ -247,6 +249,7 @@ CREATE TABLE `0_chart_types` (
   `name` varchar(60) NOT NULL default '',
   `class_id` tinyint(1) NOT NULL default '0',
   `parent` int(11) NOT NULL default '-1',
+  `inactive` tinyint(1) NOT NULL default '0',
   PRIMARY KEY  (`id`),
   KEY `name` (`name`)
 ) TYPE=MyISAM AUTO_INCREMENT=53  AUTO_INCREMENT=53 ;
@@ -254,17 +257,17 @@ CREATE TABLE `0_chart_types` (
 
 ### Data of table `0_chart_types` ###
 
-INSERT INTO `0_chart_types` VALUES ('1', 'Sales', '3', '-1');
-INSERT INTO `0_chart_types` VALUES ('2', 'Cost of Sales', '4', '-1');
-INSERT INTO `0_chart_types` VALUES ('5', 'Expenses', '4', '-1');
-INSERT INTO `0_chart_types` VALUES ('10', 'Cash/Bank', '1', '-1');
-INSERT INTO `0_chart_types` VALUES ('20', 'Accounts Receivable', '1', '-1');
-INSERT INTO `0_chart_types` VALUES ('30', 'Accounts Payable', '2', '-1');
-INSERT INTO `0_chart_types` VALUES ('40', 'Fixed Assets', '1', '-1');
-INSERT INTO `0_chart_types` VALUES ('45', 'Inventory', '1', '-1');
-INSERT INTO `0_chart_types` VALUES ('50', 'Equity', '2', '-1');
-INSERT INTO `0_chart_types` VALUES ('51', 'Depreciations', '4', '-1');
-INSERT INTO `0_chart_types` VALUES ('52', 'Financials', '4', '-1');
+INSERT INTO `0_chart_types` VALUES ('1', 'Sales', '3', '-1', '0');
+INSERT INTO `0_chart_types` VALUES ('2', 'Cost of Sales', '4', '-1', '0');
+INSERT INTO `0_chart_types` VALUES ('5', 'Expenses', '4', '-1', '0');
+INSERT INTO `0_chart_types` VALUES ('10', 'Cash/Bank', '1', '-1', '0');
+INSERT INTO `0_chart_types` VALUES ('20', 'Accounts Receivable', '1', '-1', '0');
+INSERT INTO `0_chart_types` VALUES ('30', 'Accounts Payable', '2', '-1', '0');
+INSERT INTO `0_chart_types` VALUES ('40', 'Fixed Assets', '1', '-1', '0');
+INSERT INTO `0_chart_types` VALUES ('45', 'Inventory', '1', '-1', '0');
+INSERT INTO `0_chart_types` VALUES ('50', 'Equity', '2', '-1', '0');
+INSERT INTO `0_chart_types` VALUES ('51', 'Depreciations', '4', '-1', '0');
+INSERT INTO `0_chart_types` VALUES ('52', 'Financials', '4', '-1', '0');
 
 
 ### Structure of table `0_comments` ###
@@ -718,6 +721,7 @@ CREATE TABLE `0_item_tax_types` (
   `id` int(11) NOT NULL auto_increment,
   `name` varchar(60) NOT NULL default '',
   `exempt` tinyint(1) NOT NULL default '0',
+  `inactive` tinyint(1) NOT NULL default '0',
   PRIMARY KEY  (`id`),
   UNIQUE KEY `name` (`name`)
 ) TYPE=InnoDB  AUTO_INCREMENT=1 ;
@@ -792,6 +796,7 @@ DROP TABLE IF EXISTS `0_movement_types`;
 CREATE TABLE `0_movement_types` (
   `id` int(11) NOT NULL auto_increment,
   `name` varchar(60) NOT NULL default '',
+  `inactive` tinyint(1) NOT NULL default '0',
   PRIMARY KEY  (`id`),
   UNIQUE KEY `name` (`name`)
 ) TYPE=MyISAM AUTO_INCREMENT=2  AUTO_INCREMENT=2 ;
@@ -799,7 +804,7 @@ CREATE TABLE `0_movement_types` (
 
 ### Data of table `0_movement_types` ###
 
-INSERT INTO `0_movement_types` VALUES ('1', 'Adjustment');
+INSERT INTO `0_movement_types` VALUES ('1', 'Adjustment', '0');
 
 
 ### Structure of table `0_payment_terms` ###
@@ -1463,6 +1468,7 @@ CREATE TABLE `0_tax_groups` (
   `id` int(11) NOT NULL auto_increment,
   `name` varchar(60) NOT NULL default '',
   `tax_shipping` tinyint(1) NOT NULL default '0',
+  `inactive` tinyint(1) NOT NULL default '0',
   PRIMARY KEY  (`id`),
   UNIQUE KEY `name` (`name`)
 ) TYPE=InnoDB  AUTO_INCREMENT=1 ;
@@ -1482,6 +1488,7 @@ CREATE TABLE `0_tax_types` (
   `sales_gl_code` varchar(11) NOT NULL default '',
   `purchasing_gl_code` varchar(11) NOT NULL default '',
   `name` varchar(60) NOT NULL default '',
+  `inactive` tinyint(1) NOT NULL default '0',
   PRIMARY KEY  (`id`),
   UNIQUE KEY `name` (`name`,`rate`)
 ) TYPE=InnoDB  AUTO_INCREMENT=1 ;
index 5abe4333b969de031c5e3a95cec103c302387b61..df48e0a1793d3b6a370825df7c7f4aaa0535cb8a 100644 (file)
@@ -47,9 +47,10 @@ function update_tax_group($id, $name, $tax_shipping, $taxes, $rates)
        commit_transaction();                   
 }
 
-function get_all_tax_groups()
+function get_all_tax_groups($all=false)
 {
        $sql = "SELECT * FROM ".TB_PREF."tax_groups";
+       if (!$all) $sql .= " WHERE !inactive";
        
        return db_query($sql, "could not get all tax group");
 } 
index 97a623290a272e0360390e4fe4895c666c65e8eb..897bad7cae858cd85138c6f1b2d56d8b6d95c03c 100644 (file)
@@ -29,7 +29,7 @@ function update_tax_type($type_id, $name, $sales_gl_code, $purchasing_gl_code, $
        db_query($sql, "could not update tax type");
 }
 
-function get_all_tax_types()
+function get_all_tax_types($all=false)
 {
        $sql = "SELECT ".TB_PREF."tax_types.*,
                Chart1.account_name AS SalesAccountName,
@@ -39,6 +39,7 @@ function get_all_tax_types()
                WHERE ".TB_PREF."tax_types.sales_gl_code = Chart1.account_code
                AND ".TB_PREF."tax_types.purchasing_gl_code = Chart2.account_code";
 
+       if (!$all) $sql .= " AND !".TB_PREF."tax_types.inactive";
        return db_query($sql, "could not get all tax types");
 }
 
index ac4d2f0a51d0bd743d01ad71ad5f0c7a4f12ee83..295d359519f9e93d1f7d560162b1221ea6ec4fcb 100644 (file)
@@ -101,16 +101,19 @@ if ($Mode == 'Delete')
 if ($Mode == 'RESET')
 {
        $selected_id = -1;
+       $sav = get_post('show_inactive');
        unset($_POST);
+       $_POST['show_inactive'] = $sav;
 }
 //-----------------------------------------------------------------------------------
 
 
-$result2 = $result = get_all_item_tax_types();
+$result2 = $result = get_all_item_tax_types(check_value('show_inactive'));
+
 start_form();
 start_table("$table_style width=30%");
 $th = array(_("Name"), _("Tax exempt"),'','');
-
+inactive_control_column($th);
 table_header($th);
 
 $k = 0;
@@ -130,19 +133,16 @@ while ($myrow = db_fetch($result2))
        
        label_cell($myrow["name"]);
        label_cell($disallow_text);
+       inactive_control_cell($myrow["id"], $myrow["inactive"], 'item_tax_types', 'id');
        edit_button_cell("Edit".$myrow["id"], _("Edit"));
        delete_button_cell("Delete".$myrow["id"], _("Delete"));
        end_row();
 }
 
-end_table();
-end_form();
-echo '<br>';
-
+inactive_control_row($th);
+end_table(1);
 //-----------------------------------------------------------------------------------
 
-start_form();
-
 start_table($table_style2);
 
 if ($selected_id != -1) 
index f4d919b07ffc82dfe43033ba8a228763c55e8fe5..b28f4fa998d80aca526c70e0098ce43eaf7efd4d 100644 (file)
@@ -135,15 +135,18 @@ if ($Mode == 'Delete')
 if ($Mode == 'RESET')
 {
        $selected_id = -1;
+       $sav = get_post('show_inactive');
        unset($_POST);
+       $_POST['show_inactive'] = $sav;
 }
 //-----------------------------------------------------------------------------------
 
-$result = get_all_tax_groups();
+$result = get_all_tax_groups(check_value('show_inactive'));
 
 start_form();
 start_table($table_style);
 $th = array(_("Description"), _("Tax Shipping"), "", "");
+inactive_control_column($th);
 table_header($th);
 
 $k = 0;
@@ -162,19 +165,16 @@ while ($myrow = db_fetch($result))
                if ($myrow["type" . $i] != reserved_words::get_all_numeric())
                        echo "<td>" . $myrow["type" . $i] . "</td>";*/
 
+       inactive_control_cell($myrow["id"], $myrow["inactive"], 'tax_groups', 'id');
        edit_button_cell("Edit".$myrow["id"], _("Edit"));
        delete_button_cell("Delete".$myrow["id"], _("Delete"));
        end_row();;
 }
 
-end_table();
-end_form();
-echo '<br>';
-
+inactive_control_row($th);
+end_table(1);
 //-----------------------------------------------------------------------------------
 
-start_form();
-
 start_table($table_style2);
 
 if ($selected_id != -1) 
index dc0277314095b818c51bfc50a39c3e2cc7e9246a..336697e5089c1161d7cdf2b59c71db649707ea01 100644 (file)
@@ -95,17 +95,20 @@ if ($Mode == 'Delete')
 if ($Mode == 'RESET')
 {
        $selected_id = -1;
+       $sav = get_post('show_inactive');
        unset($_POST);
+       $_POST['show_inactive'] = $sav;
 }
 //-----------------------------------------------------------------------------------
 
-$result = get_all_tax_types();
+$result = get_all_tax_types(check_value('show_inactive'));
 
 start_form();
 start_table($table_style);
 
 $th = array(_("Description"), _("Default Rate (%)"),
        _("Sales GL Account"), _("Purchasing GL Account"), "", "");
+inactive_control_column($th);
 table_header($th);
 
 $k = 0;
@@ -119,21 +122,17 @@ while ($myrow = db_fetch($result))
        label_cell($myrow["sales_gl_code"] . "&nbsp;" . $myrow["SalesAccountName"]);
        label_cell($myrow["purchasing_gl_code"] . "&nbsp;" . $myrow["PurchasingAccountName"]);
 
+       inactive_control_cell($myrow["id"], $myrow["inactive"], 'tax_types', 'id');
        edit_button_cell("Edit".$myrow["id"], _("Edit"));
        delete_button_cell("Delete".$myrow["id"], _("Delete"));
 
        end_row();
 }
 
-end_table();
-
-end_form();
-echo '<br>';
-
+inactive_control_row($th);
+end_table(1);
 //-----------------------------------------------------------------------------------
 
-start_form();
-
 start_table($table_style2);
 
 if ($selected_id != -1)