<?php
@ini_set("display_errors","1");
@ini_set("display_startup_errors","1");


require_once("include/dbcommon.php");
require_once('classes/menupage.php');


Security::processLogoutRequest();
if( !isLogged() || isLoggedAsGuest() ) 
{
	Security::tryRelogin();
}

if( !isLogged() )
{
	HeaderRedirect("login");
	return;
}


if (($_SESSION["MyURL"] == "") || (!isLoggedAsGuest())) {
	Security::saveRedirectURL();
}


require_once('include/xtempl.php');
require_once(getabspath("classes/cipherer.php"));

include_once(getabspath("include/sales_events.php"));
$tableEvents["sales"] = new eventclass_sales;
include_once(getabspath("include/product_events.php"));
$tableEvents["product"] = new eventclass_product;
include_once(getabspath("include/customer_events.php"));
$tableEvents["customer"] = new eventclass_customer;
include_once(getabspath("include/category_events.php"));
$tableEvents["category"] = new eventclass_category;
include_once(getabspath("include/brand_events.php"));
$tableEvents["brand"] = new eventclass_brand;
include_once(getabspath("include/units_events.php"));
$tableEvents["units"] = new eventclass_units;
include_once(getabspath("include/company_profile_events.php"));
$tableEvents["company_profile"] = new eventclass_company_profile;
include_once(getabspath("include/details_events.php"));
$tableEvents["details"] = new eventclass_details;
include_once(getabspath("include/seasonal_discounts_events.php"));
$tableEvents["seasonal discounts"] = new eventclass_seasonal_discounts;
include_once(getabspath("include/product1_events.php"));
$tableEvents["product1"] = new eventclass_product1;
include_once(getabspath("include/users_events.php"));
$tableEvents["Users"] = new eventclass_users;
include_once(getabspath("include/payments_events.php"));
$tableEvents["payments"] = new eventclass_payments;
include_once(getabspath("include/credit_sales_events.php"));
$tableEvents["credit_sales"] = new eventclass_credit_sales;
include_once(getabspath("include/purchasing_events.php"));
$tableEvents["purchasing"] = new eventclass_purchasing;
include_once(getabspath("include/purchasing_details_events.php"));
$tableEvents["purchasing_details"] = new eventclass_purchasing_details;
include_once(getabspath("include/customer1_events.php"));
$tableEvents["customer1"] = new eventclass_customer1;
include_once(getabspath("include/advance_purchasing_events.php"));
$tableEvents["Advance_purchasing"] = new eventclass_advance_purchasing;
include_once(getabspath("include/payment_for_pur_events.php"));
$tableEvents["payment_for_pur"] = new eventclass_payment_for_pur;
include_once(getabspath("include/payment_of_arrears_events.php"));
$tableEvents["Payment of arrears"] = new eventclass_payment_of_arrears;
include_once(getabspath("include/advance_purchasing2_events.php"));
$tableEvents["Advance_purchasing2"] = new eventclass_advance_purchasing2;
include_once(getabspath("include/cheque_register4pay_events.php"));
$tableEvents["cheque_register4pay"] = new eventclass_cheque_register4pay;
include_once(getabspath("include/purchasing_control_events.php"));
$tableEvents["purchasing_Control"] = new eventclass_purchasing_control;
include_once(getabspath("include/sales_bill_events.php"));
$tableEvents["sales Bill"] = new eventclass_sales_bill;
include_once(getabspath("include/supplier_advance_cut_events.php"));
$tableEvents["supplier_advance_cut"] = new eventclass_supplier_advance_cut;
include_once(getabspath("include/payment_in_advance_events.php"));
$tableEvents["Payment in advance"] = new eventclass_payment_in_advance;
include_once(getabspath("include/recovery_of_arrears_events.php"));
$tableEvents["recovery of arrears"] = new eventclass_recovery_of_arrears;
include_once(getabspath("include/credit_sales11_events.php"));
$tableEvents["credit_sales11"] = new eventclass_credit_sales11;
include_once(getabspath("include/quick_purchasing_events.php"));
$tableEvents["quick_purchasing"] = new eventclass_quick_purchasing;
include_once(getabspath("include/purchasing_details1_events.php"));
$tableEvents["purchasing_details1"] = new eventclass_purchasing_details1;
include_once(getabspath("include/stock_balance_events.php"));
$tableEvents["stock_balance"] = new eventclass_stock_balance;
include_once(getabspath("include/sales_history_events.php"));
$tableEvents["sales_history"] = new eventclass_sales_history;
include_once(getabspath("include/sales_history_total_events.php"));
$tableEvents["sales_history_total"] = new eventclass_sales_history_total;
include_once(getabspath("include/purchasing_list_events.php"));
$tableEvents["Purchasing List"] = new eventclass_purchasing_list;
include_once(getabspath("include/purchasing_list2_events.php"));
$tableEvents["purchasing_list2"] = new eventclass_purchasing_list2;

$xt = new Xtempl();

//array of params for classes
$params = array();
$params["id"] = postvalue_number("id"); 
$params["xt"] = &$xt;
$params["tName"] = GLOBAL_PAGES;
$params["pageType"] = PAGE_MENU;
$params["isGroupSecurity"] = $isGroupSecurity;
$params["needSearchClauseObj"] = false;
$params["pageName"] = postvalue("page"); 

$pageObject = new MenuPage($params);
$pageObject->init();

$pageObject->process();
?>