From: Janusz Dobrowolski Date: Fri, 24 Apr 2009 16:11:12 +0000 (+0000) Subject: Added inactive records support. X-Git-Tag: v2.4.2~19^2~1433 X-Git-Url: https://delta.frontaccounting.com/gitweb/?p=fa-stable.git;a=commitdiff_plain;h=0b253e5e0d23400838d3bfb4f27fb3fb2637b3ab Added inactive records support. --- diff --git a/admin/payment_terms.php b/admin/payment_terms.php index aa76bc15..ddc4c509 100644 --- a/admin/payment_terms.php +++ b/admin/payment_terms.php @@ -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 '
'; +inactive_control_row($th); +end_table(1); //------------------------------------------------------------------------------------------------- -start_form(); - start_table($table_style2); $day_in_following_month = $days_before_due = 0; diff --git a/admin/shipping_companies.php b/admin/shipping_companies.php index db26a845..720c5264 100644 --- a/admin/shipping_companies.php +++ b/admin/shipping_companies.php @@ -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 '
'; +inactive_control_row($th); +end_table(1); //---------------------------------------------------------------------------------------------- -start_form(); - start_table($table_style2); if ($selected_id != -1) diff --git a/gl/includes/db/gl_db_account_types.inc b/gl/includes/db/gl_db_account_types.inc index 82de20a4..d0f2b785 100644 --- a/gl/includes/db/gl_db_account_types.inc +++ b/gl/includes/db/gl_db_account_types.inc @@ -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"); } diff --git a/gl/includes/db/gl_db_currencies.inc b/gl/includes/db/gl_db_currencies.inc index 0c386f83..111b83dc 100644 --- a/gl/includes/db/gl_db_currencies.inc +++ b/gl/includes/db/gl_db_currencies.inc @@ -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"); } diff --git a/gl/manage/bank_accounts.php b/gl/manage/bank_accounts.php index 8b08fae8..26fe90d5 100644 --- a/gl/manage/bank_accounts.php +++ b/gl/manage/bank_accounts.php @@ -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 '
'; -start_form(); +inactive_control_row($th); +end_table(1); $is_editing = $selected_id != -1; diff --git a/gl/manage/currencies.php b/gl/manage/currencies.php index 11373fcf..2ea60107 100644 --- a/gl/manage/currencies.php +++ b/gl/manage/currencies.php @@ -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(); diff --git a/gl/manage/gl_account_classes.php b/gl/manage/gl_account_classes.php index f92d5b25..95eee370 100644 --- a/gl/manage/gl_account_classes.php +++ b/gl/manage/gl_account_classes.php @@ -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 '
'; +inactive_control_row($th); +end_table(1); //----------------------------------------------------------------------------------- -start_form(); - start_table($table_style2); if ($selected_id != -1) diff --git a/gl/manage/gl_account_types.php b/gl/manage/gl_account_types.php index 2f0529fa..080144c6 100644 --- a/gl/manage/gl_account_types.php +++ b/gl/manage/gl_account_types.php @@ -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 '
'; +inactive_control_row($th); +end_table(1); //----------------------------------------------------------------------------------- -start_form(); - start_table($table_style2); if ($selected_id != -1) diff --git a/gl/manage/gl_accounts.php b/gl/manage/gl_accounts.php index 459c3766..c78becaa 100644 --- a/gl/manage/gl_accounts.php +++ b/gl/manage/gl_accounts.php @@ -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 "
"; - echo _("Select an Account:") . " "; - gl_all_accounts_list('AccountList', null, false, false, - _('New account'), true); - echo "
"; + 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 == "") diff --git a/includes/ui/ui_lists.inc b/includes/ui/ui_lists.inc index 1ef96705..8f10f156 100644 --- a/includes/ui/ui_lists.inc +++ b/includes/ui/ui_lists.inc @@ -364,7 +364,8 @@ function _format_add_curr($row) '' : (" - " . $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 "$label\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 "\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] . " - ") : "") . $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 "$label\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 "$label\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 "$label\n"; echo ""; gl_all_accounts_list($name, $selected_id, - $skip_bank_accounts, $cells, $all_option); + $skip_bank_accounts, $cells, $all_option, $submit_on_change, $all); echo "\n"; } diff --git a/inventory/includes/db/items_units_db.inc b/inventory/includes/db/items_units_db.inc index 2d232102..b5c98d91 100644 --- a/inventory/includes/db/items_units_db.inc +++ b/inventory/includes/db/items_units_db.inc @@ -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 diff --git a/inventory/includes/db/movement_types_db.inc b/inventory/includes/db/movement_types_db.inc index 78e55a97..41fd14ac 100644 --- a/inventory/includes/db/movement_types_db.inc +++ b/inventory/includes/db/movement_types_db.inc @@ -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); diff --git a/inventory/manage/item_categories.php b/inventory/manage/item_categories.php index b5ded413..78c21944 100644 --- a/inventory/manage/item_categories.php +++ b/inventory/manage/item_categories.php @@ -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 '
'; //---------------------------------------------------------------------------------- -start_form(); - div_start('details'); start_table($table_style2); diff --git a/inventory/manage/item_units.php b/inventory/manage/item_units.php index de6154a6..64ad4dee 100644 --- a/inventory/manage/item_units.php +++ b/inventory/manage/item_units.php @@ -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 '
'; +inactive_control_row($th); +end_table(1); //---------------------------------------------------------------------------------- -start_form(); - start_table($table_style2); if ($selected_id != '') diff --git a/inventory/manage/items.php b/inventory/manage/items.php index 5dbbf556..a88c9794 100644 --- a/inventory/manage/items.php +++ b/inventory/manage/items.php @@ -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(" ", $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'); diff --git a/inventory/manage/locations.php b/inventory/manage/locations.php index bf36ac41..4fdef131 100644 --- a/inventory/manage/locations.php +++ b/inventory/manage/locations.php @@ -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 '
'; -start_form(); - start_table($table_style2); $_POST['email'] = ""; diff --git a/inventory/manage/movement_types.php b/inventory/manage/movement_types.php index 3e5d0602..aacdda94 100644 --- a/inventory/manage/movement_types.php +++ b/inventory/manage/movement_types.php @@ -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 '
'; +inactive_control_row($th); +end_table(1); //----------------------------------------------------------------------------------- -start_form(); - start_table($table_style2); if ($selected_id != -1) diff --git a/manufacturing/includes/db/work_centres_db.inc b/manufacturing/includes/db/work_centres_db.inc index c01ad50f..e1b8a023 100644 --- a/manufacturing/includes/db/work_centres_db.inc +++ b/manufacturing/includes/db/work_centres_db.inc @@ -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"); } diff --git a/manufacturing/manage/work_centres.php b/manufacturing/manage/work_centres.php index 116e4fec..769d1b4b 100644 --- a/manufacturing/manage/work_centres.php +++ b/manufacturing/manage/work_centres.php @@ -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 '
'; +inactive_control_row($th); +end_table(1); //----------------------------------------------------------------------------------- -start_form(); - start_table($table_style2); if ($selected_id != -1) diff --git a/purchasing/manage/suppliers.php b/purchasing/manage/suppliers.php index 78dbfdb1..0df75281 100644 --- a/purchasing/manage/suppliers.php +++ b/purchasing/manage/suppliers.php @@ -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); diff --git a/sales/includes/db/sales_points_db.inc b/sales/includes/db/sales_points_db.inc index 9feae5aa..35d220dd 100644 --- a/sales/includes/db/sales_points_db.inc +++ b/sales/includes/db/sales_points_db.inc @@ -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"); } diff --git a/sales/manage/sales_points.php b/sales/manage/sales_points.php index b7f292de..6282cf7f 100644 --- a/sales/manage/sales_points.php +++ b/sales/manage/sales_points.php @@ -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 '
'; +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.")); diff --git a/sql/alter2.2.sql b/sql/alter2.2.sql index 33df45e0..b0a9173e 100644 --- a/sql/alter2.2.sql +++ b/sql/alter2.2.sql @@ -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'; diff --git a/sql/en_US-demo.sql b/sql/en_US-demo.sql index 0d2cc25a..b3544add 100644 --- a/sql/en_US-demo.sql +++ b/sql/en_US-demo.sql @@ -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` ### diff --git a/sql/en_US-new.sql b/sql/en_US-new.sql index 255e2a52..5c166546 100644 --- a/sql/en_US-new.sql +++ b/sql/en_US-new.sql @@ -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 ; diff --git a/taxes/db/tax_groups_db.inc b/taxes/db/tax_groups_db.inc index 5abe4333..df48e0a1 100644 --- a/taxes/db/tax_groups_db.inc +++ b/taxes/db/tax_groups_db.inc @@ -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"); } diff --git a/taxes/db/tax_types_db.inc b/taxes/db/tax_types_db.inc index 97a62329..897bad7c 100644 --- a/taxes/db/tax_types_db.inc +++ b/taxes/db/tax_types_db.inc @@ -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"); } diff --git a/taxes/item_tax_types.php b/taxes/item_tax_types.php index ac4d2f0a..295d3595 100644 --- a/taxes/item_tax_types.php +++ b/taxes/item_tax_types.php @@ -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 '
'; - +inactive_control_row($th); +end_table(1); //----------------------------------------------------------------------------------- -start_form(); - start_table($table_style2); if ($selected_id != -1) diff --git a/taxes/tax_groups.php b/taxes/tax_groups.php index f4d919b0..b28f4fa9 100644 --- a/taxes/tax_groups.php +++ b/taxes/tax_groups.php @@ -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 "" . $myrow["type" . $i] . "";*/ + 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 '
'; - +inactive_control_row($th); +end_table(1); //----------------------------------------------------------------------------------- -start_form(); - start_table($table_style2); if ($selected_id != -1) diff --git a/taxes/tax_types.php b/taxes/tax_types.php index dc027731..336697e5 100644 --- a/taxes/tax_types.php +++ b/taxes/tax_types.php @@ -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"] . " " . $myrow["SalesAccountName"]); label_cell($myrow["purchasing_gl_code"] . " " . $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 '
'; - +inactive_control_row($th); +end_table(1); //----------------------------------------------------------------------------------- -start_form(); - start_table($table_style2); if ($selected_id != -1)