<?php
error_reporting(0); //6dec25
date_default_timezone_set('Asia/Singapore');  
set_time_limit(0); 
if (substr_count($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip')) ob_start("ob_gzhandler");
else ob_start();

session_cache_expire(60);  //9DEC24 must be called before session_start()
session_cache_limiter(); //9DEC24 called before session_start();



$cache_limiter = session_cache_limiter(); 
$cache_expire = session_cache_expire();


session_start();


date_default_timezone_set('Asia/Manila');
$CURRENT_DATE = date('Y-m-d H:i:s');
$hausplus_log = isset($_SESSION['danvillee_log']) ? strip_tags(stripslashes(trim($_SESSION['danvillee_log']))) : "";
$page = isset($_GET['pg']) ? strip_tags(stripslashes(trim($_GET['pg']))) : "";
$action = isset($_GET['action']) ? strip_tags(stripslashes(trim($_GET['action']))) : "";
$type = isset($_GET['type']) ? strip_tags(stripslashes(trim($_GET['type']))) : "";
$mainid = isset($_GET['id']) ? strip_tags(stripslashes(trim($_GET['id']))) : "";
$mainrid = isset($_GET['rid']) ? strip_tags(stripslashes(trim($_GET['rid']))) : "";
$dtype = isset($_GET['dtype']) ? strip_tags(stripslashes(trim($_GET['dtype']))) : "";
$user_type = isset($_SESSION['danvillee_user_type']) ? strip_tags(stripslashes(trim($_SESSION['danvillee_user_type']))) : "";
$action_form = "";

if ($action == "create"):
	$action_form = "Add New"; 
elseif ($type=="monitoring_folders" && $action == "batch_update"):
	$action_form = "Monitoring of Folders to be Delivered Batch Update";
elseif ($action == "edit"):
	if ($type == "monitoring_folders" || $type == "report_monitoring_folders")
	{
		$action_form = "Monitoring of Folders to be Delivered";
	}
	elseif ($type == "checklist_of_requirements")
	{
		$action_form = "Checklist of Requirements";
	}
	elseif ($type == "buyer_payment_monitoring" || $type == "report_buyer_payment_monitoring")
	{
		$action_form = "Buyer's Payment Monitoring";
	}
	elseif ($type == "partial_commission_releases_schedule")
	{
		$action_form = "Partial Commission Releases Schedule";
	}
	elseif ($type == "releases_to_broker" || $type == "report_releases_to_broker")
	{
		$action_form = "Releases to Broker";
	}
	elseif ($type == "releases_to_broker_for_wht" || $type == "report_releases_to_broker_for_wht")
	{
		$action_form = "Releases to Broker for WHT";
	}
	elseif ($type == "releases_to_contractor" || $type == "report_releases_to_contractor")
	{
		$action_form = "Releases to Contractor";
	}
	elseif ($type == "payment_status_to_broker" || $type == "report_payment_status_to_broker")
	{
		$action_form = "Payment Status to Broker";
	}
	elseif ($type == "payment_status_to_contractor" || $type == "report_payment_status_to_contractor")
	{
		$action_form = "Payment Status to Contractor";
	}
	elseif ($type == "report_buyer_payment_monitoring_on_equity")
	{
		$action_form = "Buyer's Payment Monitoring on Equity";
	}elseif ($type == "report_buyer_payment_monitoring_other_payables")
	{
		$action_form = "Buyer's Payment Monitoring on Other Payables";
	}
	elseif ($type == "buyer_status_monitoring" || $type == "report_buyer_status_monitoring")
	{
		$action_form = "Buyer's Status Monitoring";
	}
	elseif ($type == "buyer_house_renovation_monitoring" || $type == "report_buyer_house_renovation_monitoring")
	{
		$action_form = "Buyer's House Renovation Monitoring";
	}
	elseif ($type == "buyer_status_folder_pagibig" || $type == "report_buyer_status_folder_pagibig")
	{
		$action_form = "Status of Buyer's Folders with Pag-Ibig";
	}
	elseif ($type == "buyer_status_folder_bank" || $type == "report_buyer_status_folder_bank")
	{
		$action_form = "Status of Buyer's Folders with Bank";
	}
	elseif ($type == "postdated_checks_received")
	{
		$action_form = "Postdated Checks Received for Equity";
	}
	elseif ($type == "postdated_pagibig_loan_amortization")
	{
		$action_form = "Postdated Checks for Pag-IBIG Loan Amortization";
	}
	elseif ($type == "postdated_checks_status")
	{
		$action_form = "Postdated Checks Status";
	}
	elseif ($type == "broker")
	{
		$action_form = "Update Broker";
	}elseif ($type == "contractor")
	{
		$action_form = "Update Contractor";
	}
	elseif ($type == "agent")
	{
		$action_form = "Update Agent";
	}
	elseif ($type == "employee_type")
	{
		$action_form = "Update Employee Type";
	}
	elseif ($type == "position")
	{
		$action_form = "Update Position";
	}
	elseif ($type == "units"){
		$action_form = "Block & Lot";
	}
	elseif ($type == "conversion"){
		$action_form = "Conversion Monitoring";
	}
	elseif ($type == "conversion_details"){
		$action_form = "Conversion Details";
	}
	elseif ($type == "buyer_profile")
	{
		$action_form = "Update Buyer Profile";
	}
	else
	{
		$action_form = "Update";
	}
	elseif ($action == "view"):
		$action_form = "View";
	elseif ($action == "transfer"):
		$action_form = "Transfer";
	else:
		if ($type == "buyer_payment_monitoring" || $type == "report_buyer_payment_monitoring")
		{
			$action_form = "Buyer's Payment Monitoring";

		}else if ($type == "releases_to_broker" || $type == "report_releases_to_broker"){
		
			$action_form = "Releases to Broker"; 
		
		}else if ($type=="report_releases_to_broker_for_wht" || $type=="releases_to_broker_for_wht"){
			
			$action_form = "Releases to Broker for WHT";

		}else if ($type == "releases_to_contractor" || $type == "report_releases_to_contractor"){

			$action_form = "Releases to Contractor";

		}else if ($type == "payment_status_to_broker" || $type == "report_payment_status_to_broker"){
			$action_form = "Payment Status to Broker";
		}else if ($type == "payment_status_to_contractor" || $type == "report_payment_status_to_contractor")
		{
			$action_form = "Payment Status to Contractor";
		}else if ($type == "report_buyer_payment_monitoring_on_equity")
		{
			$action_form = "Buyer's Payment Monitoring on Equity";
		}else if ($type == "report_buyer_payment_monitoring_other_payables")
		{
			$action_form = "Buyer's Payment Monitoring on Other Payables";
		}
		elseif ($type == "report_summary_report_of_buyers")
		{
			if($dtype=="lacking_notice"){
				$action_form = "Postdated Checks Status";
			}else{
				$action_form = "Summary Report of Buyers with Deficiency";
			}
			
		}
		elseif ($type == "report_schedule_of_loan_folders")
		{
			$action_form = "Schedule of Loan Folders for Delivery to Pag-ibig";
		}
		elseif ($type == "schedule_of_loan_folders")
		{
			$action_form = "Schedule of Loan Folders for Delivery to Pag-ibig";
		}
		elseif ($type == "report_monitoring_folders")
		{
			$action_form = "Monitoring of Folders to be Delivered";
		}
		elseif ($type == "buyer_status_monitoring" || $type == "report_buyer_status_monitoring")
		{
			$action_form = "Buyer's Status Monitoring";
		}
		elseif ($type == "buyer_house_renovation_monitoring" || $type == "report_buyer_house_renovation_monitoring")
		{
			$action_form = "Buyer's House Renovation Monitoring";
		}
		elseif ($type == "buyer_status_folder_pagibig" || $type == "report_buyer_status_folder_pagibig")
		{
			$action_form = "Status of Buyer's Folders with Pag-Ibig";
		}
		elseif ($type == "buyer_status_folder_bank" || $type == "report_buyer_status_folder_bank")
		{
			$action_form = "Status of Buyer's Folders with Bank";
		}
		elseif ($type == "postdated_checks_received")
		{
			$action_form = "Postdated Checks Received for Equity";
		}
		elseif ($type == "postdated_pagibig_loan_amortization")
		{
			$action_form = "Postdated Checks for Pag-IBIG Loan Amortization";
		}
		elseif ($type == "postdated_checks_status")
		{
			$action_form = "Postdated Checks Status";
		}
		elseif ($type == "monthly_sales_reservation")
		{
			$action_form = "Monthly Sales Reservation";
		}
		elseif ($type == "sales_report_per_broker")
		{
			$action_form = "Sales Report per Broker";
		}
		elseif ($type == "sales_report_per_agent")
		{
			$action_form = "Sales Report per Agent";
		}
		elseif ($type == "broker")
		{
			$action_form = "Brokers";
		}
		elseif ($type == "contractor")
		{
			$action_form = "Contractors";
		}
		elseif ($type == "agent")
		{
			$action_form = "Agent";
		}
		elseif ($type == "employee_type")
		{
			$action_form = "Employee Type";
		}
		elseif ($type == "position")
		{
			$action_form = "Position";
		}
		elseif ($type == "buyer_profile")
		{
			$action_form = "Buyer Profile";
		}
		elseif ($type == "report_summary_po_to_contractor")
		{
			$action_form = "Summary of P.O. Awarded to Contractors";
		}
		else
		{
			$action_form = "List";
		}

	endif;
	if ($hausplus_log == "yes"):
		include_once ('./template/header.php'); 
		if($page != ""):
			if ($action != "" && $action == "batch_update"){
				include_once ("./heart/batch_update_form.php");
			}else if ($action != "" && $action != "print"){
				include_once ("./heart/" . $type . "_form.php");
			}else{
				if($type == "report_summary_report_of_buyers"){
					include_once ("./heart/report_$dtype.php");
				}else if($type == "monthly_sales_reservation"){
					include_once ("./heart/report_$dtype.php");
				}else{
					include_once ("./heart/$type.php");
				}
			}
		else:
			include_once ("./heart/dashboard.php");

		endif;
		include_once ('./template/footer.php');

	else:
		include_once ('./signin.php');

	endif;
	ob_end_flush();