<?
session_start();
require_once("config.inc.php");
require_once("database.class.php");
require_once("login.class.php");
require_once("utility.class.php");
require_once("user_setup.class.php");
require_once("product_setup.class.php");
require_once("customer_setup.class.php");
require_once("customer_category_setup.class.php");
require_once("employee_category_setup.class.php");
require_once("employee_setup.class.php");
require_once("employee_setup_mart.class.php");
require_once("expense_category_setup.class.php");
require_once("expense_setup.class.php");
require_once("expense_mart_category_setup.class.php");
require_once("expense_mart_setup.class.php");
require_once("purchase_category_setup.class.php");
require_once("purchase_setup.class.php");
require_once("bank_setup.class.php");
require_once("stock.class.php");
require_once("production_stock.class.php");
require_once("production.class.php");
require_once("batch_setup.class.php");
require_once("ing_setup.class.php");
require_once("menu.class.php");
require_once("upload.class.php");
require_once("helper.class.php");
require_once("control.configuration.class.php");
require_once("invoice.class.php");
require_once("invoice_rate.class.php");
require_once("rate_list.class.php");
require_once("payment.class.php");
require_once("payment_customer.class.php");
require_once("refund.class.php");
require_once("purpayment.class.php");
require_once("ledger.class.php");
require_once("attendance.class.php");
require_once("loan_setup.class.php");
require_once("loan_setup_mart.class.php");
require_once("salary_setup.class.php");
require_once("salary_setup_mart.class.php");
require_once("holiday_setup.class.php");
require_once("leave_setup.class.php");
require_once("statement_bank_setup.class.php");
require_once("bank_transaction_setup.class.php");
require_once("director_setup.class.php");
require_once("packaging_cost_setup.class.php");
require_once("purchase_order.class.php");        // header + CRUD
require_once("purchase_order_item.class.php");   // item-level ops (optional split)
require_once("purchase_order_item.class.php");   // item-level ops (optional split)
require_once("supplier_setup.class.php"); 
require_once("invoice_stock_usage.class.php");
require_once("paid_to_setup.class.php");



//require_once("city.class.php");
//require_once("product.class.php");
//require_once("packages.class.php");
//require_once("client.class.php");
//require_once("payment.class.php");
//require_once("policy.class.php");
//require_once("agent.class.php");
//require_once("branch.class.php");
//require_once("business.class.php");
//require_once("confirmation-cancel.class.php");
//require_once("branch_setup.class.php");
//require_once("do_setup.class.php");
//require_once("co_setup.class.php");
//require_once("agent_setup.class.php");
//require_once("condition_setup.class.php");
//require_once("warranties_setup.class.php");
//require_once("user.profile.setup.php");
//require_once("product.controller.class.php");
//require_once("client.setup.class.php");
//require_once("make_setup.class.php");
//require_once("renewal.class.php");
//require_once("renewal_parameter.class.php");
//require_once("renewal_dashboard.class.php");
//require_once("notifications.class.php");
//require_once("report.class.php");
//require_once("report_builder.class.php");
//require_once("bodytype.class.php");
//require_once("swipepay.class.php");
//require_once("renewal_policies.class.php");
//require_once("log_exception.class.php");
//require_once("renewal_decline.class.php");
//require_once("commercialproduct.class.php");
//require_once("decline_customer_setup.class.php");
//require_once("decline_vehicle_setup.class.php");
//require_once("tracker_setup.class.php");
//require_once("soap.class.php");
//require_once("log_tracker.class.php");
//require_once("motor.controller.class.php");
//require_once("workshop.class.php");
//require_once("city.class.php");
//require_once("so_setup.class.php");
//require_once("customerworkflow.class.php");
//require_once("customer_claimtype.class.php");
//require_once("surveyworkflow.class.php");
//require_once("survey_claimtype.class.php");
//require_once("claim.class.php");
// Igis Authentication
//require_once("auth.igis.class.php");
//require_once("sms_setup.class.php");
//require_once("surveypicture.class.php");
//require_once("surveydamagesdetail.class.php");
//require_once("checklist.class.php");
//require_once("surveyworkflow_checklistdetail.class.php");
//require_once("parts_reference.class.php");
//require_once("surveycostdetail.class.php");
//require_once("survey_checklistdetail.class.php");
//require_once("survey.class.php");
//require_once("survey_log.class.php");
//require_once("approval.class.php");
//require_once("geocode.class.php");
//require_once("claim_loss_detail.class.php");

class Manager
{


    function __construct()
    {
        if(isset($_SESSION['nextclass']) && $_SESSION['nextclass'] == 1){
            global $db;
            $db = new Database(DB_SERVERS, DB_USERS, DB_PASS, DB_DATABASES);
            $db->connect();
            global $db1;
            $db1 = new Database(DB_SERVERS, DB_USERS, DB_PASS, DB_DATABASES);
            $db1->connect();
            global $db2;
            $db2 = new Database(DB_SERVERS, DB_USERS, DB_PASS, DB_DATABASES);
            $db2->connect();
        }else if(isset($_SESSION['nextclass']) && $_SESSION['nextclass'] == 2){
            global $db;
            $db = new Database(DB_SERVERSTX, DB_USERSTX, DB_PASS, DB_DATABASESTX);
            $db->connect();
            global $db1;
            $db1 = new Database(DB_SERVERSTX, DB_USERSTX, DB_PASS, DB_DATABASESTX);
            $db1->connect();
            global $db2;
            $db2 = new Database(DB_SERVERSTX, DB_USERSTX, DB_PASS, DB_DATABASESTX);
            $db2->connect();
        }else {
            global $db;
            $db = new Database(DB_SERVER, DB_USER, DB_PASS, DB_DATABASE);
            $db->connect();
            global $db1;
            $db1 = new Database(DB_SERVERS, DB_USERS, DB_PASS, DB_DATABASES);
            $db1->connect();
            global $db2;
            $db2 = new Database(DB_SERVERSTX, DB_USERSTX, DB_PASS, DB_DATABASESTX);
            $db2->connect();
        }
//        global $db;
//
//        $db = new Database(DB_SERVER, DB_USER, DB_PASS, DB_DATABASE);
//
//        $db->connect();

        date_default_timezone_set('Asia/Karachi');
    }


}


?>
