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
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();
} //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;
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
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)
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");
}
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");
}
//---------------------------------------------------------------------------------------------
-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");
}
$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");
$th = array(_("Account Name"), _("Type"), _("Currency"), _("GL Account"),
_("Bank"), _("Number"), _("Bank Address"),'','');
+inactive_control_column($th);
table_header($th);
$k = 0;
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;
{
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
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"));
} //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'");
}
{
global $table_style2, $Mode;
- start_form();
start_table($table_style2);
if ($selected_id != '')
end_table(1);
submit_add_or_update_center($selected_id == '', '', 'both');
-
- end_form();
}
//---------------------------------------------------------------------------------------------
$_POST['hundreds_name'] = '';
}
+start_form();
display_currencies();
display_currency_edit($selected_id);
-
+end_form();
//---------------------------------------------------------------------------------------------
end_page();
}
//-----------------------------------------------------------------------------------
-$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;
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)
}
//-----------------------------------------------------------------------------------
-$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;
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)
$_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."));
}
if (db_has_gl_accounts())
{
- echo "<center>";
- echo _("Select an Account:") . " ";
- 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);
$_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);
{
$_POST['account_code'] = $_POST['account_code2'] = '';
$_POST['account_name'] = $_POST['account_type'] = '';
+ $_POST['inactive'] = 0;
text_row_ex(_("Account Code:"), 'account_code', 11);
}
gl_account_types_list_row(_("Account Group:"), 'account_type', null);
+record_status_list_row(_("Account status:"), 'inactive');
end_table(1);
if ($selected_account == "")
'' : (" - " . $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;
'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;
}
//---------------------------------------------------------------------------------------------------
-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;
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 "<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;
}
/*
} 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',
//------------------------------------------------------------------------------------
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";
//-----------------------------------------------------------------------------------------------
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
'cells' => true,
'select_submit'=> $submit_on_change,
'async' => false,
- 'category' => 2
+ 'category' => 2,
+ 'show_inactive' => $all
) );
}
}
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";
}
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
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");
}
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);
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');
$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");
$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
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);
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
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 != '')
$_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
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');
if ($new_item)
{
text_row(_("Item Code:"), 'NewStockID', null, 21, 20);
+ $_POST['inactive'] = 0;
}
else
{ // Must be modifying an existing item
$_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');
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');
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'] = "";
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))
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)
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");
}
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;
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)
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
{
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
{
$_POST['purchase_account'] = $myrow["purchase_account"];
$_POST['payment_discount_account'] = $myrow["payment_discount_account"];
$_POST['notes'] = $myrow["notes"];
-
+ $_POST['inactive'] = $myrow["inactive"];
}
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"));
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);
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");
}
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;
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."));
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';
`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` ###
`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 ;
### 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` ###
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 ;
### 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` ###
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 ;
### 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` ###
`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 ;
### 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` ###
`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` ###
`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` ###
`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 ;
### 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` ###
`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 ;
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 ;
### 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` ###
`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 ;
`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 ;
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");
}
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,
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");
}
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;
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)
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;
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)
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;
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 '<br>';
-
+inactive_control_row($th);
+end_table(1);
//-----------------------------------------------------------------------------------
-start_form();
-
start_table($table_style2);
if ($selected_id != -1)