<?php    
//account database
$MySQLQuery_account = mysql_query("SELECT * FROM tbl_account WHERE id='1'"); 
while($row= mysql_fetch_assoc($MySQLQuery_account))
{
    $db_account_id = $row['id'];
    $db_account_account_no = $row['account_no'];
    $db_account_account_name = $row['account_name'];
    $db_account_address = $row['address'];
    $db_account_phone_no = $row['phone_no'];
    $db_account_mobile_no = $row['mobile_no'];
    $db_account_email = $row['email'];
    $db_account_website = $row['website'];
    $db_account_license = $row['license'];
    $db_account_timezone_id = $row['timezone_id'];
    $db_account_country_id = $row['country_id'];
    $db_account_language_id = $row['language_id'];
    $db_account_currency_id = $row['currency_id'];
    $db_account_number_format_id = $row['number_format_id'];
    $db_account_date = $row['date'];
    $db_account_time = $row['time'];
}

//timezone database
$MySQLQuery_timezone = mysql_query("SELECT * FROM tbl_timezone WHERE id='$db_account_timezone_id'"); 
while($row= mysql_fetch_assoc($MySQLQuery_timezone))
{
    $db_timezone_id = $row['id'];
    $db_timezone_timezone = $row['timezone'];
}

//country database
$MySQLQuery_country = mysql_query("SELECT * FROM tbl_country WHERE id='$db_account_country_id'"); 
while($row= mysql_fetch_assoc($MySQLQuery_country))
{
    $db_country_id = $row['id'];
    $db_country_code= $row['code'];
    $db_country_country = $row['country'];
}

//language database
$MySQLQuery_language = mysql_query("SELECT * FROM tbl_language WHERE id='$db_account_language_id'"); 
while($row= mysql_fetch_assoc($MySQLQuery_language))
{
    $db_language_id = $row['id'];
    $db_language_image= $row['image'];
    $db_language_language = $row['language'];
    $db_language_code= $row['code'];
}

//currency database
$MySQLQuery_currency = mysql_query("SELECT * FROM tbl_currency WHERE id='$db_account_currency_id'"); 
while($row= mysql_fetch_assoc($MySQLQuery_currency))
{
    $db_currency_id = $row['id'];
    $db_currency_currency = $row['currency'];
    $db_currency_code1 = $row['code1'];
    $db_currency_code2 = $row['code2'];
}

//number format database
$MySQLQuery_number_format = mysql_query("SELECT * FROM tbl_number_format WHERE id='$db_account_number_format_id'"); 
while($row= mysql_fetch_assoc($MySQLQuery_number_format))
{
    $db_number_format_id = $row['id'];
    $db_number_format_number_format = $row['number_format'];
    $db_number_format_description = $row['description'];
}

//user database
$MySQLQuery_user = mysql_query("SELECT * FROM tbl_user WHERE id='$_SESSION[SessionUserLogUserID]'"); 
$numrows_user = mysql_num_rows($MySQLQuery_user);
while($row= mysql_fetch_assoc($MySQLQuery_user))
{
    $db_user_id= $row['id'];
    $db_user_user_no= $row['user_no'];
    $db_user_image= $row['image'];
    $db_user_username= $row['username'];
    $db_user_password = $row['password'];
    $db_user_firstname= $row['firstname'];
    $db_user_middlename = $row['middlename'];
    $db_user_middlename_sub =  substr($db_user_middlename,0,1);
    $db_user_lastname = $row['lastname'];
    $db_user_birth_date = $row['birth_date'];
    $db_user_age = floor((time() - strtotime($db_user_birth_date)) / 31556926);
    $db_user_gender = $row['gender'];
    $db_user_address= $row['address'];
    $db_user_phone_no= $row['phone_no'];
    $db_user_mobile_no= $row['mobile_no'];
    $db_user_email = $row['email'];
    $db_user_department_id = $row['department_id'];
    $db_user_user_type_id = $row['user_type_id'];
    $db_user_date = $row['date'];
    $db_user_time = $row['time'];
    $db_user_a_status = $row['a_status'];
}

//user type & access level database
$MySQLQuery_user_type= mysql_query("SELECT * FROM tbl_user_type WHERE id='$db_user_user_type_id'"); 
while($row= mysql_fetch_assoc($MySQLQuery_user_type))
{
    $db_user_type_user_type_name= $row['user_type_name'];
    $db_user_type_user_type_name_strup  = strtoupper($db_user_type_user_type_name);
    $db_user_type_dashboard = $row['dashboard'];
    $db_user_type_user = $row['user'];
    $db_user_type_user_type = $row['user_type'];
    $db_user_type_patient = $row['patient'];
    $db_user_type_inpatient = $row['inpatient'];
    $db_user_type_outpatient = $row['outpatient'];
    $db_user_type_room = $row['room'];
    $db_user_type_bed = $row['bed'];
    $db_user_type_consultant = $row['consultant'];
    $db_user_type_item = $row['item'];
    $db_user_type_department = $row['department'];
    $db_user_type_billing = $row['billing'];
    
}

//no. of inpatient database
$MySQLQuery_transaction_monitoring1 = mysql_query("SELECT * FROM tbl_transaction WHERE pt_type_id='1'"); 
$numrows_transaction_monitoring1 = mysql_numrows($MySQLQuery_transaction_monitoring1);
$numrows_transaction_monitoring1_nf = number_format($numrows_transaction_monitoring1);

//no. of outpatient database
$MySQLQuery_transaction_monitoring2 = mysql_query("SELECT * FROM tbl_transaction WHERE pt_type_id='2'"); 
$numrows_transaction_monitoring2 = mysql_numrows($MySQLQuery_transaction_monitoring2);
$numrows_transaction_monitoring2_nf = number_format($numrows_transaction_monitoring2);
?>