Revonzy Mini Shell

Revonzy Mini Shell

Şuanki Dizin: /home/wwwdreamtechnolo/www/b2bflight.com/B2BFlight/project/dashboard/lib/
Dosya Yükle :
Şuanki Dosya : /home/wwwdreamtechnolo/www/b2bflight.com/B2BFlight/project/dashboard/lib/functions.php

<?php
	session_start();
	date_default_timezone_set('Asia/Kolkata');
	
	$logo	=	"logo1.jpeg";
	$project_name	=	"B2B Flight";

	class class_functions
	{
		private $con;
		
		function __construct()
		{
			$this->con	=	new mysqli("localhost","wwwdreamtechnolo_admin_b2bflight","6akorommb1o5","wwwdreamtechnolo_b2bflight");
			//$this->con	=	new mysqli("localhost","root","","aone_tailors");
		}
		

	function update_password($new_pass,$old_pass)
    {
        if($stmt_insert = $this->con->prepare("UPDATE `software_users` SET `password` = ? where `password`=?"))
        {
          $stmt_insert->bind_param("ss",$new_pass,$old_pass);
        
          if($stmt_insert->execute())
          { 
            return true;
          }
            return false;
        }
    }

    function agent_update_password($new_pass,$old_pass)
    {
        if($stmt_insert = $this->con->prepare("UPDATE `register` SET `password` = ? where `password`=?"))
        {
          $stmt_insert->bind_param("ss",$new_pass,$old_pass);
        
          if($stmt_insert->execute())
          { 
            return true;
          }
            return false;
        }
    }

      function update_totalamount($total_amt,$id)
    {
        if($stmt_insert = $this->con->prepare("UPDATE `flight_booking` SET `passanger_total` = ? where `id`=?"))
        {
          $stmt_insert->bind_param("si",$total_amt,$id);
        
          if($stmt_insert->execute())
          { 
            return true;
          }
            return false;
        }
    }

		function get_password_from_user_empcode($emp_code)
		{
			if($stmt_select = $this->con->prepare("Select `password` from `software_users` where `employee_code` = ? "))
			{
				$stmt_select->bind_param("s",$emp_code);
			
				$stmt_select->bind_result($result_password);
			
				if($stmt_select->execute())
				{
					if($stmt_select->fetch())
					{
						return $result_password;
					}
				}
				return false;
			}
		}
		
		function get_group_name_exist_id($group_name)
		{
			if($stmt_select = $this->con->prepare("Select `id` from `groups` where `group_name` = ? "))
			{
				$stmt_select->bind_param("s",$group_name);
			
				$stmt_select->bind_result($result_id);
			
				if($stmt_select->execute())
				{
					if($stmt_select->fetch())
					{
						return $result_id;
					}
				}
				return false;
			}
		}
		
		function get_expenses_name_exist_id($expenses_name)
		{
			if($stmt_select = $this->con->prepare("Select `id` FROM `expenses_category` where `expenses_name` = ? "))
			{
				$stmt_select->bind_param("s",$expenses_name);
			
				$stmt_select->bind_result($result_id);
			
				if($stmt_select->execute())
				{
					if($stmt_select->fetch())
					{
						return $result_id;
					}
				}
				return false;
			}
		}
		
		function get_group_name_from_id($group_name)
		{
			if($stmt_select = $this->con->prepare("Select `group_name` from `groups` where `id` = ? "))
			{
				$stmt_select->bind_param("i",$group_name);
			
				$stmt_select->bind_result($result_id);
			
				if($stmt_select->execute())
				{
					if($stmt_select->fetch())
					{
						return $result_id;
					}
				}
				return false;
			}
		}
		function get_expenses_name_from_id($expenses_name)
		{
			if($stmt_select = $this->con->prepare("Select `expenses_name` from `expenses_category` where `id` = ? "))
			{
				$stmt_select->bind_param("i",$expenses_name);
			
				$stmt_select->bind_result($result_id);
			
				if($stmt_select->execute())
				{
					if($stmt_select->fetch())
					{
						return $result_id;
					}
				}
				return false;
			}
		}
		
		function get_test_name_from_id($edit_id)
		{
			if($stmt_select = $this->con->prepare("SELECT `test_name` FROM `test_master` WHERE  `id` = ? "))
			{
				$stmt_select->bind_param("i",$edit_id);
			
				$stmt_select->bind_result($result_id);
			
				if($stmt_select->execute())
				{
					if($stmt_select->fetch())
					{
						return $result_id;
					}
				}
				return false;
			}
		}
		

		function get_sample_group_type_from_id($edit_id)
		{
			if($stmt_select = $this->con->prepare("Select `group_name`,`sample_type_name` from `sample_types` where `id` = ?"))
			{
				$stmt_select->bind_param("i",$edit_id);
			
				$stmt_select->bind_result($group_name,$sample_type_name);
			
				if($stmt_select->execute())
				{
					$data	=	array();
					if($stmt_select->fetch())
					{
						$data[0]	=	$group_name;
						$data[1]	=	$sample_type_name;
						
						return $data;
					}
				}
				return false;
			}
		}
		function get_expenses_type_from_id($edit_id)
		{ 
			if($stmt_select = $this->con->prepare("SELECT `expenses`, `titel`, `expenses_date`, `expenses_amount`, `description`, `date`, `time` FROM `expenses` WHERE `id` = ?"))
			{ 
				$stmt_select->bind_param("i",$edit_id);
			
				$stmt_select->bind_result($expenses,$titel,$expenses_date,$expenses_amount,$description,$date,$time);
			
				if($stmt_select->execute())
				{ 
					$data	=	array();
					if($stmt_select->fetch())
					{
						$data[0]	=	$expenses;
						$data[1]	=	$titel;
						$data[2]	=	$expenses_date;
						$data[3]	=	$expenses_amount;
						$data[4]	=	$description;

						return $data;
					} 
				}
				return false;
			}
		}
		
		function get_standard_title_type_from_id($edit_id)
		{ 
			if($stmt_select = $this->con->prepare("Select `standard_name`,`standard_title` from `standard_master` where `id` = ?"))
			{ 
				$stmt_select->bind_param("i",$edit_id);
			
				$stmt_select->bind_result($test_name,$standard_title);
			
				if($stmt_select->execute())
				{ 
					$data	=	array();
					if($stmt_select->fetch())
					{ 
						$data[0]	=	$test_name;
						$data[1]	=	$standard_title;
						
						return $data;
					}
				}
				return false;
			}
		}
		
		function get_emp_code_exist($emp_code)
		{
			if($stmt_select = $this->con->prepare("Select `id` from `software_users` where `employee_code` = ? "))
			{
				$stmt_select->bind_param("s",$emp_code);
			
				$stmt_select->bind_result($result_id);
			
				if($stmt_select->execute())
				{
					if($stmt_select->fetch())
					{
						return $result_id;
					}
				}
				return false;
			}
		}
		function get_emp_code_exist_from_mobile_no($mobile_no)
		{
			if($stmt_select = $this->con->prepare("Select `id` from `customer` where `mobile_no` = ? "))
			{
				$stmt_select->bind_param("s",$mobile_no);
			
				$stmt_select->bind_result($result_id);
			
				if($stmt_select->execute())
				{
					if($stmt_select->fetch())
					{
						return $result_id;
					}
				}
				return false;
			}
		}
		
		function get_emp_code_exist_from_worker($mobile_no)
		{
			if($stmt_select = $this->con->prepare("Select `id` from `worker` where `mobile_no` = ? "))
			{
				$stmt_select->bind_param("s",$mobile_no);
			
				$stmt_select->bind_result($result_id);
			
				if($stmt_select->execute())
				{
					if($stmt_select->fetch())
					{
						return $result_id;
					}
				}
				return false;
			}
		}
		
		function get_emp_code_exist_from_agent($mobile_no)
		{
			if($stmt_select = $this->con->prepare("Select `id` from `agent` where `mobile_no` = ? "))
			{
				$stmt_select->bind_param("s",$mobile_no);
			
				$stmt_select->bind_result($result_id);
			
				if($stmt_select->execute())
				{
					if($stmt_select->fetch())
					{
						return $result_id;
					}
				}
				return false;
			}
		}
		
		function get_client_exist($client_name,$mobile_no)
		{
			if($stmt_select = $this->con->prepare("Select `id` from `clients` where `client_name` = ? AND `mobile_no` = ?"))
			{
				$stmt_select->bind_param("ss",$client_name,$mobile_no);
			
				$stmt_select->bind_result($result_id);
			
				if($stmt_select->execute())
				{
					if($stmt_select->fetch())
					{
						return $result_id;
					}
				}
				return false;
			}
		}
		
		function get_group_and_sample_name_exist_id($group_name,$sample_title)
		{
			if($stmt_select = $this->con->prepare("Select `id` from `sample_types` where `group_name` = ? AND `sample_type_name`=?"))
			{
				$stmt_select->bind_param("ss",$group_name,$sample_title);
			
				$stmt_select->bind_result($result_id);
			
				if($stmt_select->execute())
				{
					if($stmt_select->fetch())
					{
						return $result_id;
					}
				}
				return false;
			}
		}
		function get_add_expenses_exist_id($expenses_category,$tite,$expenses_date,$expenses_amount,$description)
		{
			if($stmt_select = $this->con->prepare("Select `id` FROM `expenses` where `expenses_category` = ? ,`titel`=? , `expenses_date`=?, `expenses_amount`=?, `description`=?"))
			{
				$stmt_select->bind_param("sssss",$expenses_category,$tite,$expenses_date,$expenses_amount,$description);
			
				$stmt_select->bind_result($result_id);
			
				if($stmt_select->execute())
				{
					if($stmt_select->fetch())
					{
						return $result_id;
					}
				}
				return false;
			}
		}
		
		function get_standard_and_standard_name_exist_id($standard_name,$standard_title)
		{
			if($stmt_select = $this->con->prepare("SELECT `id` FROM `standard_master`where `standard_name` = ? AND `standard_title`=?"))
			{
				$stmt_select->bind_param("ss",$standard_name,$standard_title);
			
				$stmt_select->bind_result($result_id);
			
				if($stmt_select->execute())
				{
					if($stmt_select->fetch())
					{
						return $result_id;
					}
				}
				return false;
			}
		}
		function get_payment_schedule_exist_id($customer_id,$net_amount,$payment_schedule_date,$payment_amount)
		{
			if($stmt_select = $this->con->prepare("SELECT `id` FROM `payment_schedule` where `customer_id` = ? ,`net_amount`=? ,`payment_schedule_date`=? ,`net_amount`=?"))
			{
				$stmt_select->bind_param("ssssss",$customer_id,$net_amount,$payment_schedule_date,$payment_amount);
			
				$stmt_select->bind_result($result_id);
			
				if($stmt_select->execute())
				{
					if($stmt_select->fetch())
					{
						return $result_id;
					}
				}
				return false;
			}
		}
		
		function insert_payment_schedule($customer_id,$net_amount,$payment_schedule_date,$payment_amount)
		{
			$date = date("Y-m-d");
			$time = date("H-i-s A");
			
			if($stmt_insert = $this->con->prepare("INSERT INTO `payment_schedule`(`customer_id`, `net_amount`, `payment_schedule_date`, `payment_amount`, `date`, `time`) VALUES (?,?,?,?,?,?)"))
			{
				$stmt_insert->bind_param("ssssss",$customer_id,$net_amount,$payment_schedule_date,$payment_amount,$date,$time);
				
				if($stmt_insert->execute())
				{
					return true;
				}
					return false;
			} 	
		}
		
		function insert_new_standard_name($standard_name,$standard_title)
		{
			$date = date("Y-m-d");
			$time = date("H-i-s A");
			
			if($stmt_insert = $this->con->prepare("INSERT INTO `standard_master`(`standard_name`, `standard_title`, `date`, `time`) VALUES (?,?,?,?)"))
			{
				$stmt_insert->bind_param("ssss",$standard_name,$standard_title,$date,$time);
				
				if($stmt_insert->execute())
				{
					return true;
				}
					return false;
			} 	
		}
		
		function delete_standard_master_name($del_id)
		{
			if($stmt_select = $this->con->prepare("DELETE FROM `standard_master` WHERE `id`=?"))
			{
				$stmt_select->bind_param("i",$del_id);
			
				if($stmt_select->execute())
				{					
						return true;
				}
					return false;
			}
		}
		function delete_payment_schedule($del_id)
		{
			if($stmt_select = $this->con->prepare("DELETE FROM `payment_schedule` WHERE`id`=?"))
			{
				$stmt_select->bind_param("i",$del_id);
			
				if($stmt_select->execute())
				{					
						return true;
				}
					return false;
			}
		}
		
		function get_title_name_from_id($group_id)
		{
			if($stmt_select = $this->con->prepare("Select `group_name` from `groups` where `id` = ?"))
			{
				$stmt_select->bind_param("i",$group_id);
			
				$stmt_select->bind_result($result_name);
			
				if($stmt_select->execute())
				{
					if($stmt_select->fetch())
					{
						return $result_name;
					}
				}
				return false;
			}
		}
		
		function get_standar_master_from_id($group_id)
		{
			if($stmt_select = $this->con->prepare("Select `group_name` from `groups` where `id` = ?"))
			{
				$stmt_select->bind_param("i",$group_id);
			
				$stmt_select->bind_result($result_name);
			
				if($stmt_select->execute())
				{
					if($stmt_select->fetch())
					{
						return $result_name;
					}
				}
				return false;
			}
		}
		function get_payment_schedule_from_id($customer_id)
		{
			if($stmt_select = $this->con->prepare("SELECT `id`, `customer_id`, `net_amount`, `payment_schedule_date`, `payment_amount`, `date`, `time` FROM `payment_schedule` `id` = ?"))
			{
				$stmt_select->bind_param($customer_id);
			
				$stmt_select->bind_result($result_name);
			
				if($stmt_select->execute())
				{
					if($stmt_select->fetch())
					{
						return $result_name;
					}
				}
				return false;
			}
		}
		
	
		function insert_new_group_name($group_name)
		{
			$date = date("Y-m-d");
			$time = date("H-i-s A");
			
			if($stmt_insert = $this->con->prepare("INSERT INTO `groups`(`group_name`, `date`, `time`) VALUES (?,?,?)"))
			{
				$stmt_insert->bind_param("sss",$group_name,$date,$time);
				
				if($stmt_insert->execute())
				{
					return true;
				}
					return false;
			} 	
		}
		function insert_new_expenses_name($expenses_name)
		{
			$date = date("Y-m-d");
			$time = date("H-i-s A");
			
			if($stmt_insert = $this->con->prepare("INSERT INTO `expenses_category`( `expenses_name`, `date`, `time`) VALUES (?,?,?)"))
			{
				$stmt_insert->bind_param("sss",$expenses_name,$date,$time);
				
				if($stmt_insert->execute())
				{
					return true;
				}
					return false;
			} 	
		}
		
		function insert_new_test_name($test_name)
		{echo 11;
			$date = date("Y-m-d");
			$time = date("H-i-s A");
			
			if($stmt_insert = $this->con->prepare("INSERT INTO `test_master`(`test_name`, `date`, `time`) VALUES (?,?,?)"))
			{ echo 22;
				$stmt_insert->bind_param("sss",$test_name,$date,$time);
				
				if($stmt_insert->execute())
				{ echo 33;
					return true;
				}
					return false;
			} 	
		}
		
		
		
		function get_test_name_exist_id($test_name)
		{
			if($stmt_select = $this->con->prepare("SELECT `id`, `test_name`, `date`, `time` FROM `test_master`  = ? "))
			{
				$stmt_select->bind_param("s",$test_name);
			
				$stmt_select->bind_result($result_id);
			
				if($stmt_select->execute())
				{
					if($stmt_select->fetch())
					{
						return $result_id;
					}
				}
				return false;
			}
		}
		
		function delete_test_name($del_id)
		{
			if($stmt_select = $this->con->prepare("DELETE FROM `test_master` WHERE `id`=?"))
			{
				$stmt_select->bind_param("i",$del_id);
			
				if($stmt_select->execute())
				{					
						return true;
				}
					return false;
			}
		}
		
	
		
		function update_group_name($group_name,$edit_id)
		{
			$date = date("Y-m-d");
			$time = date("H-i-s A");
			
			if($stmt_insert = $this->con->prepare("UPDATE `groups` SET `group_name`=? WHERE `id`=?"))
			{
				$stmt_insert->bind_param("si",$group_name,$edit_id);
				
				if($stmt_insert->execute())
				{
					return true;
				}
					return false;
			} 	
		}
		function update_expenses_name($expenses_name,$edit_id)
		{
			$date = date("Y-m-d");
			$time = date("H-i-s A");
			
			if($stmt_insert = $this->con->prepare("UPDATE `expenses_category` SET `expenses_name`=? WHERE  `id`=?"))
			{
				$stmt_insert->bind_param("si",$expenses_name,$edit_id);
				
				if($stmt_insert->execute())
				{
					return true;
				}
					return false;
			} 	
		}
		
		function update_group_type_name($group_name,$sample_title,$edit_id)
		{
			$date = date("Y-m-d");
			$time = date("H-i-s A");
			
			if($stmt_insert = $this->con->prepare("UPDATE `sample_types` SET `group_name`=?,`sample_type_name`=?,`date`=?,`time`=? WHERE `id`=?"))
			{
				$stmt_insert->bind_param("ssssi",$group_name,$sample_title,$date,$time,$edit_id);
				
				if($stmt_insert->execute())
				{
					return true;
				}
				return false;
			} 	
		}
		function update_expenses_type_name($expenses,$titel,$expenses_date,$expenses_amount,$description,$edit_id)
		{
			$date = date("Y-m-d");
			$time = date("H-i-s A");
			
			if($stmt_insert = $this->con->prepare("UPDATE `expenses` SET `expenses`=?,`titel`=?,`expenses_date`=?,`expenses_amount`=?,`description`=?,`date`=?,`time`=? WHERE `id`=?"))
			{
				$stmt_insert->bind_param("sssssssi",$expenses,$titel,$expenses_date,$expenses_amount,$description,$date,$time,$edit_id);
				
				if($stmt_insert->execute())
				{
					return true;
				}
				return false;
			} 	
		}
		
		function update_standard_master_name($standard_name,$standard_title,$edit_id)
		{ 
			$date = date("Y-m-d");
			$time = date("H-i-s A");
			
			if($stmt_insert = $this->con->prepare("UPDATE `standard_master` SET `standard_name`=?,`standard_title`=?,`date`=?,`time`=? WHERE `id`=?"))
			{ 
				$stmt_insert->bind_param("ssssi",$standard_name,$standard_title,$date,$time,$edit_id);
				
				if($stmt_insert->execute())
				{ 
					return true;
				}
				return false;
			} 	
		}
		
		function update_test_name($test_name,$edit_id)
		{
			$date = date("Y-m-d");
			$time = date("H-i-s A");
			
			if($stmt_insert = $this->con->prepare("UPDATE `test_master` SET `test_name`=? WHERE `id`=?"))
			{
				$stmt_insert->bind_param("si",$test_name,$edit_id);
				
				if($stmt_insert->execute())
				{
					return true;
				}
					return false;
			} 	
		}
		
		

		
		function get_all_test_names()
		{
			
			if($stmt_insert = $this->con->prepare("SELECT `id`, `test_name`, `date`, `time` FROM `test_master`"))
			{	
				$stmt_insert->bind_result($id,$test_name,$date,$time);
				
				if($stmt_insert->execute())
				{
					$counter	=	0;
					$details	=	array();
					while($stmt_insert->fetch())
					{
						$details[$counter][0]	=	$id;
						$details[$counter][1]	=	$test_name;
						$details[$counter][2]	=	$date;
						$details[$counter][3]	=	$time;
					
						$counter++;
					}
					if(!empty($details))	
					{
						return $details;
					}
					return false;
				}	
			}
		}
		
		function get_title_from_category_id($category_id)
		{
			
			if($stmt_insert = $this->con->prepare("SELECT `title` FROM `tailor_master` WHERE `id`=?"))
			{	
				$stmt_insert->bind_param("i",$category_id);
				
				$stmt_insert->bind_result($res_title);
				
				if($stmt_insert->execute())
				{
					if($stmt_insert->fetch())
					{
						return $res_title;
					}
					return false;
				}	
			}
		}
		
		function get_name_from_worker_id($workers)
		{
			
			if($stmt_insert = $this->con->prepare("SELECT `name` FROM `worker` WHERE `id`=?"))
			{	
				$stmt_insert->bind_param("i",$workers);
				
				$stmt_insert->bind_result($workers_name);
				
				if($stmt_insert->execute())
				{
					if($stmt_insert->fetch())
					{
						return $workers_name;
					}
					return false;
				}	
			}
		}
		
		function get_all_payment_schedule_names()
		{
			
			if($stmt_insert = $this->con->prepare("SELECT `id`, `customer_id`, `net_amount`, `payment_schedule_date`, `payment_amount`, `date`, `time` FROM `payment_schedule`"))
			{	
				$stmt_insert->bind_result($id,$customer_id,$net_amount,$payment_schedule_date,$payment_amount,$date,$time);
				
				if($stmt_insert->execute())
				{
					$counter	=	0;
					$details	=	array();
					while($stmt_insert->fetch())
					{
						$details[$counter][0]	=	$id;
						$details[$counter][1]	=	$customer_id;
						$details[$counter][2]	=	$net_amount;
						$details[$counter][3]	=	$payment_schedule_date;
						$details[$counter][4]	=	$payment_amount;
						$details[$counter][5]	=	$date;
						$details[$counter][6]	=	$time;
	
						$counter++;
					}
					if(!empty($details))	
					{
						return $details;
					}
					return false;
				}	
			}
		}
		
		function insert_new_employee($emp_code,$full_name,$email_id,$mobile_no,$designation,$password)
		{
			$date = date("Y-m-d");
			$time = date("H-i-s A");
			$account_status	=	"Active";
			
			if($stmt_insert = $this->con->prepare("INSERT INTO `software_users`(`employee_code`, `full_name`, `email_id`, `mobile_no`, `designation`, `password`, `account_status`, `date`, `time`) VALUES (?,?,?,?,?,?,?,?,?)"))
			{
				$stmt_insert->bind_param("sssssssss",$emp_code,$full_name,$email_id,$mobile_no,$designation,$password,$account_status,$date,$time);
				
				if($stmt_insert->execute())
				{
					return true;
				}
				return false;
			} 	
		}
		
		function insert_new_agent($emp_code,$full_name,$email_id,$mobile_no,$address,$password)
		{
			$date = date("Y-m-d");
			$time = date("H-i-s A");
			$account_status	=	"Active";
			
			if($stmt_insert = $this->con->prepare("INSERT INTO `agent`( `employee_code`, `full_name`, `email_id`, `mobile_no`, `address`, `password`, `date`, `time`) VALUES (?,?,?,?,?,?,?,?)"))
			{
				$stmt_insert->bind_param("ssssssss",$emp_code,$full_name,$email_id,$mobile_no,$address,$password,$date,$time);
				
				if($stmt_insert->execute())
				{
					return true;
				}
				return false;
			} 	
		}
		

		
		function insert_new_customer($name,$address,$mobile_no,$opening_balance,$joining_date,$photo,$city)
		{
			$date = date("Y-m-d");
			$time = date("H-i-s A");
			$account_status	=	"Active";
			
			if($stmt_insert = $this->con->prepare("INSERT INTO `customer`( `name`, `address`, `mobile_no`, `opening_balance`, `joining_date`, `photo`, `city`, `date`, `time`) VALUES (?,?,?,?,?,?,?,?,?)"))
			{
				$stmt_insert->bind_param("sssssssss",$name,$address,$mobile_no,$opening_balance,$joining_date,$photo,$city,$date,$time);
				
				if($stmt_insert->execute())
				{
					return true;
				}
				return false;
			} 	
		}
		function insert_new_worker($name,$address,$mobile_no,$opening_balance,$joining_date,$photo,$city)
		{
			$date = date("Y-m-d");
			$time = date("H-i-s A");
			$account_status	=	"Active";
			
			if($stmt_insert = $this->con->prepare("INSERT INTO `worker`( `name`, `address`, `mobile_no`, `opening_balance`, `joining_date`, `photo`, `city`, `date`, `time`) VALUES (?,?,?,?,?,?,?,?,?)"))
			{
				$stmt_insert->bind_param("sssssssss",$name,$address,$mobile_no,$opening_balance,$joining_date,$photo,$city,$date,$time);
				
				if($stmt_insert->execute())
				{
					return true;
				}
				return false;
			} 	
		}
		
		function insert_new_client($client_name,$company_name,$email,$mobile_no,$address,$contact_person_name,$contact_mobile_no1,$contact_mobile_no2,$project_location,$remarks)
		{
			$date = date("Y-m-d");
			$time = date("H-i-s A");
			$account_status	=	"Active";
			
			if($stmt_insert = $this->con->prepare("INSERT INTO `clients`(`client_name`, `company_name`, `email`, `mobile_no`, `address`, `contact_person_name`, `contact_mobile_no1`, `contact_mobile_no2`, `project_location`, `remarks`, `date`, `time`) VALUES (?,?,?,?,?,?,?,?,?,?,?,?)"))
			{
				$stmt_insert->bind_param("ssssssssssss",$client_name,$company_name,$email,$mobile_no,$address,$contact_person_name,$contact_mobile_no1,$contact_mobile_no2,$project_location,$remarks,$date,$time);
				
				if($stmt_insert->execute())
				{
					return true;
				}
				return false;
			} 	
		}
		
		function insert_new_inward_entry($lab_type,$location,$lab_ref_no,$entry_date,$client_name,$project_name,$source_of_sample,$group_of_sample,$type_of_sample,$quantity_of_sample,$quality_of_sample,$acceptance_criteria,$sample_receive_by,$remarks)
		{
			$date = date("Y-m-d");
			$time = date("H-i-s A");
						
			if($stmt_insert = $this->con->prepare("INSERT INTO `inward`(`lab_type`, `location`, `lab_ref_no`, `entry_date`, `client_name`, `project_name`, `source_of_sample`, `group_of_sample`, `type_of_sample`, `quantity_of_sample`, `quality_of_sample`, `acceptance_criteria`, `sample_receive_by`, `remarks`, `date`, `time`) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"))
			{
				$stmt_insert->bind_param("ssssssssssssssss",$lab_type,$location,$lab_ref_no,$entry_date,$client_name,$project_name,$source_of_sample,$group_of_sample,$type_of_sample,$quantity_of_sample,$quality_of_sample,$acceptance_criteria,$sample_receive_by,$remarks,$date,$time);
				
				if($stmt_insert->execute())
				{
					return true;
				}
				return false;
			} 	
		}
		
		function insert_add_project_entry($project_name,$project_address,$registration_no,$location,$project_type,$project_current_status,$project_layout,$project_logo,$image1,$image2,$image3,$image4,$image5,$image6,$image7,$image8,$image9,$image10,$video,$no_of_towers,$project_selling_status,$latitude,$longitude,$added,$project_facilities,$description)
		{ 
			$date = date("Y-m-d");
			$time = date("H-i-s A");
			$added = date("");
						
			if($stmt_insert = $this->con->prepare("INSERT INTO `projects`( `project_name`, `project_address`, `registration_no`, `location`, `project_type`, `project_current_status`, `project_layout`, `project_logo`, `image1`, `image2`, `image3`, `image4`, `image5`, `image6`, `image7`, `image8`, `image9`, `image10`, `video`, `no_of_towers`, `project_selling_status`, `latitude`, `longitude`, `added`, `project_facilities`, `description`, `date`, `time`) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"))
			{ 
				$stmt_insert->bind_param("ssssssssssssssssssssssssssss",$project_name,$project_address,$registration_no,$location,$project_type,$project_current_status,$project_layout,$project_logo,$image1,$image2,$image3,$image4,$image5,$image6,$image7,$image8,$image9,$image10,$video,$no_of_towers,$project_selling_status,$latitude,$longitude,$added,$project_facilities,$description,$date,$time);
				
				if($stmt_insert->execute())
				{ 
					return true;
				} 
				return false;
			} 	
		}
		
		function insert_add_measurement_entry($measurement_for,$customer_name,$shirt1,$shirt2,$shirt3,$shirt4,$shirt5,$shirt6,$shirt7,$shirt8,$shirt9,$shirt10,$shirt11,$shirt12,$shirt13,$shirt14,$shirt15,$shirt16,$shirt17,$shirt18,$cup_size,$cup_style,$shirt_style,$shirt_size,$patti,$shirt_design,$shirt_remark,$pant1,$pant2,$pant3,$pant4,$pant5,$pant6,$pant7,$pant8,$pant9,$pant10,$pant11,$pant12,$pocket_size,$back_pocket,$watch_pocket,$mobile_pocket,$bottom_style,$plate,$pocket,$iron,$stiching,$pant_remark,$mobile_number,$delivery_date,$delivery_status,$payment_method)
		{ 
			$date = date("Y-m-d");
			$time = date("H-i-s A");
						
			if($stmt_insert = $this->con->prepare("INSERT INTO `shirt_measurement`( `measurement_for`, `customer_name`, `shirt1`, `shirt2`, `shirt3`, `shirt4`, `shirt5`, `shirt6`, `shirt7`, `shirt8`, `shirt9`, `shirt10`, `shirt11`, `shirt12`, `shirt13`, `shirt14`, `shirt15`, `shirt16`, `shirt17`, `shirt18`, `cup_size`, `cup_style`, `shirt_style`, `shirt_size`, `patti`, `shirt_design`, `shirt_remark`, `pant1`, `pant2`, `pant3`, `pant4`, `pant5`, `pant6`, `pant7`, `pant8`, `pant9`, `pant10`, `pant11`, `pant12`, `pocket_size`, `back_pocket`, `watch_pocket`, `mobile_pocket`, `bottom_style`, `plate`, `pocket`, `iron`, `stiching`, `pant_remark`, `mobile_number`, `delivery_date`, `delivery_status`,`payment_method`, `date`, `time`) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"))
			{ 
				$stmt_insert->bind_param("sssssssssssssssssssssssssssssssssssssssssssssssssssssss",$measurement_for,$customer_name,$shirt1,$shirt2,$shirt3,$shirt4,$shirt5,$shirt6,$shirt7,$shirt8,$shirt9,$shirt10,$shirt11,$shirt12,$shirt13,$shirt14,$shirt15,$shirt16,$shirt17,$shirt18,$cup_size,$cup_style,$shirt_style,$shirt_size,$patti,$shirt_design,$shirt_remark,$pant1,$pant2,$pant3,$pant4,$pant5,$pant6,$pant7,$pant8,$pant9,$pant10,$pant11,$pant12,$pocket_size,$back_pocket,$watch_pocket,$mobile_pocket,$bottom_style,$plate,$pocket,$iron,$stiching,$pant_remark,$mobile_number,$delivery_date,$delivery_status,$payment_method,$date,$time);
				
				if($stmt_insert->execute())
				{ 
					return $stmt_insert->insert_id;
				} 
				return false;
			} 	
		}
		
		function insert_user_payment_entry($receipt_id,$shirt_price,$pant_price,$total_amount,$discount_amount,$payable_amount,$paid_amount,$balance_amount,$delivery_status)
		{ 
			$date = date("Y-m-d");
			$time = date("H-i-s A");

			if($stmt_insert = $this->con->prepare("INSERT INTO `user_payment`(`receipt_id`, `shirt_price`, `pant_price`, `total_amount`, `discount_amount`, `payable_amount`, `paid_amount`, `balance_amount`, `delivery_status`, `date`, `time`) VALUES (?,?,?,?,?,?,?,?,?,?,?)"))
			{ 
				$stmt_insert->bind_param("sssssssssss",$receipt_id,$shirt_price,$pant_price,$total_amount,$discount_amount,$payable_amount,$paid_amount,$balance_amount,$delivery_status,$date,$time);
				
				if($stmt_insert->execute())
				{ 
					return $stmt_insert->insert_id;
				} 
				return false;
			} 	
		}
		
		function add_plot_entry($project_id,$plot_owener,$enter_floor_no,$unit_no,$unit_label,$sq_mtr,$sq_ft,$lambi,$rundi,$carpet_area,$bulit_up_area,$saleable_area,$facing,$approximate_rate_per_sq_ft,$latitude,$longitude,$phase,$plot_status,$unit_type,$select_bhk,$image1,$image2,$image3,$image4,$image5)
		{
			$date = date("Y-m-d");
			$time = date("H-i-s A");
			$added = date("");
						
			if($stmt_insert = $this->con->prepare("INSERT INTO `plot_project`(`project_id`, `plot_owener`, `enter_floor_no`, `unit_no`, `unit_label`, `sq_mtr`, `sq_ft`, `lambi`, `rundi`, `plot_status`, `unit_type`, `select_bhk`, `carpet_area`, `bulit_up_area`, `saleable_area`, `facing`, `approximate_rate_per_sq_ft`, `latitude`, `longitude`, `phase`, `image1`, `image2`, `image3`, `image4`, `image5`, `date`, `time`) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"))
			{ 
				$stmt_insert->bind_param("sssssssssssssssssssssssssss",$project_id,$plot_owener,$enter_floor_no,$unit_no,$unit_label,$sq_mtr,$sq_ft,$lambi,$rundi,$carpet_area,$bulit_up_area,$saleable_area,$facing,$approximate_rate_per_sq_ft,$latitude,$longitude,$phase,$plot_status,$unit_type,$select_bhk,$image1,$image2,$image3,$image4,$image5,$date,$time);
				
				if($stmt_insert->execute())
				{ 
					return true;
				} 
				return false;
			} 	
		}
		
		function add_booking_entry($booking_date,$select_project,$unit_no,$size_sq_ft,$rate_sq_ft,$total_amount,$discount,$rate_after_discount,$round_off,$net_amount,$load_from_leads_data,$mobile_no,$custamer_name,$email_id,$address,$pincode,$dob,$nominee,$age_of_nominee,$payment_type,$adhar_number,$PAN_card,$adhar_card_image,$PAN_card_image,$customer_photo_adhar_card,$cash_receipt_PAN_card_image,$customer_image,$cash_receipt,$sold_by,$commission,$plat_status,$remark)
		{
			$date = date("Y-m-d");
			$time = date("H-i-s A");
						
			if($stmt_insert = $this->con->prepare("INSERT INTO `bookings`( `booking_date`, `select_project`, `unit_no`, `size_sq_ft`, `rate_sq_ft`, `total_amount`, `discount`, `rate_after_discount`, `round_off`, `net_amount`, `load_from_leads_data`, `mobile_no`, `custamer_name`, `email_id`, `address`, `pincode`, `dob`, `nominee`, `age_of_nominee`, `payment_type`, `adhar_number`, `PAN_card`, `adhar_card_image`, `PAN_card_image`, `customer_photo_adhar_card`, `cash_receipt_PAN_card_image`, `customer_image`, `cash_receipt`, `sold_by`, `commission`, `plat_status`, `remark`, `date`, `time`) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"))
			{ 
				$stmt_insert->bind_param("ssssssssssssssssssssssssssssssssss",$booking_date,$select_project,$unit_no,$size_sq_ft,$rate_sq_ft,$total_amount,$discount,$rate_after_discount,$round_off,$net_amount,$load_from_leads_data,$mobile_no,$custamer_name,$email_id,$address,$pincode,$dob,$nominee,$age_of_nominee,$payment_type,$adhar_number,$PAN_card,$adhar_card_image,$PAN_card_image,$customer_photo_adhar_card,$cash_receipt_PAN_card_image,$customer_image,$cash_receipt,$sold_by,$commission,$plat_status,$remark,$date,$time);
				
				if($stmt_insert->execute())
				{ 
					return true;
				} 
				return false;
			} 	
		}
		
				
		function add_payment_entry($received_date,$receipt_no,$manual_receipt_no,$type_of_payment,$payment_mode,$amount,$remark)
		{ 
			$date = date("Y-m-d");
			$time = date("H-i-s A");
						
			if($stmt_insert = $this->con->prepare("INSERT INTO `payment`( `received_date`, `receipt_no`, `manual_receipt_no`, `type_of_payment`, `payment_mode`, `amount`, `remark`, `date`, `time`) VALUES (?,?,?,?,?,?,?,?,?)"))
			{ 
				$stmt_insert->bind_param("sssssssss",$received_date,$receipt_no,$manual_receipt_no,$type_of_payment,$payment_mode,$amount,$remark,$date,$time);
				
				if($stmt_insert->execute())
				{ 
					return true;
				} 
				return false;
			} 	
		}
		
		function add_enquiry_entry($project_id,$plot_no,$full_name,$dob,$mobile_no1,$mobile_no2,$email,$address,$occupation,$resource,$property_space,$property_type,$description,$status)
		{ 
			$date = date("Y-m-d");
			$time = date("H-i-s A");
						
			if($stmt_insert = $this->con->prepare("INSERT INTO `enquiry_form`(`project_id`, `plot_no`, `full_name`, `dob`, `mobile_no1`, `mobile_no2`, `email`, `address`, `occupation`, `resource`, `property_space`, `property_type`, `description`, `status`, `date`, `time`) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"))
			{ 
				$stmt_insert->bind_param("ssssssssssssssss", $project_id, $plot_no, $full_name, $dob, $mobile_no1, $mobile_no2, $email, $address, $occupation, $resource, $property_space, $property_type, $description, $status, $date, $time);
				
				if($stmt_insert->execute())
				{ 
					return true;
				} 
				return false;
			} 	
		}
		
		function add_work_entry($workers,$delivery_date,$remark,$view_id)
		{ 
			$date = date("Y-m-d");
			$time = date("H-i-s A");
						
			if($stmt_insert = $this->con->prepare("INSERT INTO `assigned_work`(`workers`, `delivery_date`, `remark`, `date`, `time`,`receipt_id`) VALUES (?,?,?,?,?,?)"))
			{ 
				$stmt_insert->bind_param("ssssss", $workers,$delivery_date,$remark, $date, $time,$view_id);
				
				if($stmt_insert->execute())
				{ 
					return true;
				} 
				return false;
			} 	
		}

		function add_worker_payment($workers,$amount,$payment_method,$remark)
		{ 
			$date = date("Y-m-d");
			$time = date("H-i-s A");
						
			if($stmt_insert = $this->con->prepare("INSERT INTO `worker-payment`(`name`, `amount`, `payment_method`, `remark`, `date`, `time`) VALUES (?,?,?,?,?,?)"))
			{ 
				$stmt_insert->bind_param("ssssss", $workers,$amount,$payment_method,$remark, $date, $time);
				
				if($stmt_insert->execute())
				{ 
					return true;
				} 
				return false;
			} 	
		}
	
		
		function payment_schedule_entry($customer_id,$net_amount,$payment_schedule_date,$payment_amount)
		{
			$date = date("Y-m-d");
			$time = date("H-i-s A");
						
			if($stmt_insert = $this->con->prepare("INSERT INTO `payment_schedule`( `customer_id`, `net_amount`, `payment_schedule_date`, `payment_amount`, `date`, `time`) VALUES (?,?,?,?,?,?)"))
			{ 
				$stmt_insert->bind_param("ssssss",$customer_id,$net_amount,$payment_schedule_date,$payment_amount,$date,$time);
				
				if($stmt_insert->execute())
				{ 
					return true;
				} 
				return false;
			} 	
		}
		
		
		function add_job_number_entry($department,$enter_reference,$company_name,$company_initials,$client_name,$sub_contractor,$project_name,$location,$job_number,$references,$remark)
		{
			$date = date("Y-m-d");
			$time = date("H-i-s A");
						
			if($stmt_insert = $this->con->prepare("INSERT INTO `job_number`( `department`, `enter_reference`, `company_name`, `company_initials`, `client_name`, `sub_contractor`, `project_name`, `location`, `job_numbar`, `references`, `remark`, `date`, `time`) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?)"))
			{
				$stmt_insert->bind_param("sssssssssssss",$department,$enter_reference,$company_name,$company_initials,$client_name,$sub_contractor,$project_name,$location,$job_number,$references,$remark,$date,$time);
				
				if($stmt_insert->execute())
				{
					return true;
				}
				return false;
			} 	
		}
		
		function insert_new_sample_type_name($group_name,$sample_type_name)
		{
			$date = date("Y-m-d");
			$time = date("H-i-s A");
			
			if($stmt_insert = $this->con->prepare("INSERT INTO `sample_types`(`group_name`,`sample_type_name`, `date`, `time`) VALUES (?,?,?,?)"))
			{
				$stmt_insert->bind_param("ssss",$group_name,$sample_type_name,$date,$time);
				
				if($stmt_insert->execute())
				{
					return true;
				}
					return false;
			} 	
		}
		
		function new_expenses_type_name($expenses_category,$tite,$expenses_date,$expenses_amount,$description)
		{
			$date = date("Y-m-d");
			$time = date("H-i-s A");
			
			if($stmt_insert = $this->con->prepare("INSERT INTO `expenses`( `expenses`, `titel`, `expenses_date`, `expenses_amount`, `description`, `date`, `time`) VALUES (?,?,?,?,?,?,?)"))
			{
				
				$stmt_insert->bind_param("sssssss",$expenses_category,$tite,$expenses_date,$expenses_amount,$description,$date,$time);
				
				if($stmt_insert->execute())
				{
					return true;
				}
					return false;
			} 	
		}
		
		function get_all_group_names()
		{
			if($stmt_insert = $this->con->prepare("SELECT `id`, `group_name`, `date`, `time` FROM `groups`"))
			{	
				$stmt_insert->bind_result($id,$group_name,$date,$time);
				
				if($stmt_insert->execute())
				{
					$counter	=	0;
					$details	=	array();
					while($stmt_insert->fetch())
					{
						$details[$counter][0]	=	$id;
						$details[$counter][1]	=	$group_name;
						$details[$counter][2]	=	$date;
						$details[$counter][3]	=	$time;
					
						$counter++;
					}
					if(!empty($details))	
					{
						return $details;
					}
					return false;
				}	
			}
		}
		function get_all_expenses_data()
		{
			if($stmt_insert = $this->con->prepare("SELECT `id`, `group_name`, `date`, `time` FROM `groups`"))
			{	
				$stmt_insert->bind_result($id,$group_name,$date,$time);
				
				if($stmt_insert->execute())
				{
					$counter	=	0;
					$details	=	array();
					while($stmt_insert->fetch())
					{
						$details[$counter][0]	=	$id;
						$details[$counter][1]	=	$group_name;
						$details[$counter][2]	=	$date;
						$details[$counter][3]	=	$time;
					
						$counter++;
					}
					if(!empty($details))	
					{
						return $details;
					}
					return false;
				}	
			}
		}
		function get_all_expenses()
		{
			if($stmt_insert = $this->con->prepare("SELECT `id`, `expenses_category`, `titel`, `expenses_date`, `expenses_amount`, `description`, `date`, `time` FROM `expenses`"))
			{	
				$stmt_insert->bind_result($id,$expenses_category,$titel,$expenses_date,$expenses_amount,$description,$date,$time);
				
				if($stmt_insert->execute())
				{
					$counter	=	0;
					$details	=	array();
					while($stmt_insert->fetch())
					{
						$details[$counter][0]	=	$id;
						$details[$counter][1]	=	$expenses_category;
						$details[$counter][2]	=	$titel;
						$details[$counter][3]	=	$expenses_date;
						$details[$counter][4]	=	$expenses_amount;
						$details[$counter][5]	=	$description;
						$details[$counter][6]	=	$date;
						$details[$counter][7]	=	$time;
					
						$counter++;
					}
					if(!empty($details))	
					{
						return $details;
					}
					return false;
				}	
			}
		}
		function get_all_expenses_names()
		{
			if($stmt_insert = $this->con->prepare("SELECT `id`, `expenses_name`, `date`, `time` FROM `expenses_category`"))
			{	
				$stmt_insert->bind_result($id,$expenses_name,$date,$time);
				
				if($stmt_insert->execute())
				{
					$counter	=	0;
					$details	=	array();
					while($stmt_insert->fetch())
					{
						$details[$counter][0]	=	$id;
						$details[$counter][1]	=	$expenses_name;
						$details[$counter][2]	=	$date;
						$details[$counter][3]	=	$time;
					
						$counter++;
					}
					if(!empty($details))	
					{
						return $details;
					}
					return false;
				}	
			}
		}
			function get_all_standard_title()
		{
			if($stmt_insert = $this->con->prepare("SELECT `id`, `standard_name`, `standard_title`, `date`, `time` FROM `standard_master`"))
			{	
				$stmt_insert->bind_result($id,$res_standard_name,$standard_title,$date,$time);
				
				if($stmt_insert->execute())
				{
					$counter	=	0;
					$details	=	array();
					while($stmt_insert->fetch())
					{
						$details[$counter][0]	=	$id;
						$details[$counter][1]	=	$res_standard_name;
						$details[$counter][2]	=	$date;
						$details[$counter][3]	=	$time;
					
						$counter++;
					}
					if(!empty($details))	
					{
						return $details;
					}
					return false;
				}	
			}
		}
		
		function get_all_software_users_data()
		{
			if($stmt_insert = $this->con->prepare("SELECT `id`, `employee_code`, `full_name`, `email_id`, `mobile_no`, `designation`, `password`, `account_status`, `date`, `time` FROM `software_users`"))
			{	
				$stmt_insert->bind_result($id,$employee_code,$full_name,$email_id,$mobile_no,$designation,$password,$account_status,$date,$time);
				
				if($stmt_insert->execute())
				{
					$counter	=	0;
					$details	=	array();
					while($stmt_insert->fetch())
					{
						$details[$counter][0]	=	$id;
						$details[$counter][1]	=	$employee_code;
						$details[$counter][2]	=	$full_name;
						$details[$counter][3]	=	$email_id;
						$details[$counter][4]	=	$mobile_no;
						$details[$counter][5]	=	$designation;
						$details[$counter][6]	=	$account_status;
						$details[$counter][7]	=	$date;
						$details[$counter][8]	=	$time;
					
						$counter++;
					}
					if(!empty($details))	
					{
						return $details;
					}
					return false;
				}	
			}
		}
		
		function get_all_agent_data()
		{
			if($stmt_insert = $this->con->prepare("SELECT `id`, `employee_code`, `full_name`, `email_id`, `mobile_no`, `address`, `password`, `date`, `time` FROM `agent`"))
			{	
				$stmt_insert->bind_result($id,$employee_code,$full_name,$email_id,$mobile_no,$address,$password,$date,$time);
				
				if($stmt_insert->execute())
				{
					$counter	=	0;
					$details	=	array();
					while($stmt_insert->fetch())
					{
						$details[$counter][0]	=	$id;
						$details[$counter][1]	=	$employee_code;
						$details[$counter][2]	=	$full_name;
						$details[$counter][3]	=	$email_id;
						$details[$counter][4]	=	$mobile_no;
						$details[$counter][5]	=	$address;
						$details[$counter][6]	=	$date;
						$details[$counter][7]	=	$time;
					
						$counter++;
					}
					if(!empty($details))	
					{
						return $details;
					}
					return false;
				}	
			}
		}
		
		function get_all_customer_data()
		{
			if($stmt_insert = $this->con->prepare("SELECT `id`, `name`, `address`, `mobile_no`, `opening_balance`, `joining_date`, `photo`, `city`, `date`, `time` FROM `customer`"))
			{	
				$stmt_insert->bind_result($id,$name,$address,$mobile_no,$opening_balance,$joining_date,$photo,$city,$date,$time);
				
				if($stmt_insert->execute())
				{
					$counter	=	0;
					$details	=	array();
					while($stmt_insert->fetch())
					{
						$details[$counter][0]	=	$id;
						$details[$counter][1]	=	$name;
						$details[$counter][2]	=	$address;
						$details[$counter][3]	=	$mobile_no;
						$details[$counter][4]	=	$opening_balance;
						$details[$counter][5]	=	$joining_date;
						$details[$counter][6]	=	$photo;
						$details[$counter][7]	=	$city;
						$details[$counter][8]	=	$date;
						$details[$counter][9]	=	$time;
					
						$counter++;
					}
					if(!empty($details))	
					{
						return $details;
					}
					return false;
				}	
			}
		}
		function get_all_worker_data()
		{
			if($stmt_insert = $this->con->prepare("SELECT `id`, `name`, `address`, `mobile_no`, `opening_balance`, `joining_date`, `photo`, `city`, `date`, `time` FROM `worker`"))
			{	
				$stmt_insert->bind_result($id,$name,$address,$mobile_no,$opening_balance,$joining_date,$photo,$city,$date,$time);
				
				if($stmt_insert->execute())
				{
					$counter	=	0;
					$details	=	array();
					while($stmt_insert->fetch())
					{
						$details[$counter][0]	=	$id;
						$details[$counter][1]	=	$name;
						$details[$counter][2]	=	$address;
						$details[$counter][3]	=	$mobile_no;
						$details[$counter][4]	=	$opening_balance;
						$details[$counter][5]	=	$joining_date;
						$details[$counter][6]	=	$photo;
						$details[$counter][7]	=	$city;
						$details[$counter][8]	=	$date;
						$details[$counter][9]	=	$time;
					
						$counter++;
					}
					if(!empty($details))	
					{
						return $details;
					}
					return false;
				}	
			}
		}
		
		function get_all_clients_data()
		{
			if($stmt_insert = $this->con->prepare("SELECT `id`, `client_name`, `company_name`, `email`, `mobile_no`, `address`, `contact_person_name`, `contact_mobile_no1`, `contact_mobile_no2`, `project_location`, `remarks`, `date`, `time` FROM `clients`"))
			{	
				$stmt_insert->bind_result($id,$client_name,$company_name,$email,$mobile_no,$address,$contact_person_name,$contact_mobile_no1,$contact_mobile_no2,$project_location,$remarks,$date,$time);
				
				if($stmt_insert->execute())
				{
					$counter	=	0;
					$details	=	array();
					while($stmt_insert->fetch())
					{
						$details[$counter][0]	=	$id;
						$details[$counter][1]	=	$client_name;
						$details[$counter][2]	=	$company_name;
						$details[$counter][3]	=	$email;
						$details[$counter][4]	=	$mobile_no;
						$details[$counter][5]	=	$address;
						$details[$counter][6]	=	$contact_person_name;
						$details[$counter][7]	=	$contact_mobile_no1;
						$details[$counter][8]	=	$contact_mobile_no2;
						$details[$counter][9]	=	$project_location;
						$details[$counter][10]	=	$remarks;
						$details[$counter][11]	=	$date;
						$details[$counter][12]	=	$time;
					
						$counter++;
					}
					if(!empty($details))	
					{
						return $details;
					}
					return false;
				}	
			}
		}
		
		function get_all_inward_data()
		{
			if($stmt_insert = $this->con->prepare("SELECT `id`, `lab_type`, `location`, `lab_ref_no`, `entry_date`, `client_name`, `project_name`, `source_of_sample`, `group_of_sample`, `type_of_sample`, `quantity_of_sample`, `quality_of_sample`, `acceptance_criteria`, `sample_receive_by`, `remarks`, `date`, `time` FROM `inward`"))
			{	
				$stmt_insert->bind_result($id,$lab_type,$location,$lab_ref_no,$entry_date,$client_name,$project_name,$source_of_sample,$group_of_sample,$type_of_sample,$quantity_of_sample,$quality_of_sample,$acceptance_criteria,$sample_receive_by,$remarks,$date,$time);
				
				if($stmt_insert->execute())
				{
					$counter	=	0;
					$details	=	array();
					while($stmt_insert->fetch())
					{
						$details[$counter][0]	=	$id;
						$details[$counter][1]	=	$lab_type;
						$details[$counter][2]	=	$location;
						$details[$counter][3]	=	$lab_ref_no;
						$details[$counter][4]	=	$entry_date;
						$details[$counter][5]	=	$client_name;
						$details[$counter][6]	=	$project_name;
						$details[$counter][7]	=	$source_of_sample;
						$details[$counter][8]	=	$group_of_sample;
						$details[$counter][9]	=	$type_of_sample;
						$details[$counter][10]	=	$quantity_of_sample;
						$details[$counter][11]	=	$quality_of_sample;
						$details[$counter][12]	=	$acceptance_criteria;						
						$details[$counter][13]	=	$sample_receive_by;
						$details[$counter][14]	=	$remarks;
						$details[$counter][15]	=	$date;
						$details[$counter][16]	=	$time;
					
						$counter++;
					}
					if(!empty($details))	
					{
						return $details;
					}
					return false;
				}	
			}
		}
		

		function get_all_add_project()
		{
			if($stmt_insert = $this->con->prepare("SELECT `id`, `project_name`, `project_address`, `registration_no`, `location`, `project_type`, `project_current_status`, `project_layout`, `project_logo`, `image1`, `image2`, `image3`, `image4`, `image5`, `image6`, `image7`, `image8`, `image9`, `image10`, `video`, `no_of_towers`, `project_selling_status`, `latitude`, `longitude`, `added`, `project_facilities`, `description`, `date`, `time` FROM `projects`"))
			{	
				$stmt_insert->bind_result($id,$project_name,$project_address,$registration_no,$location,$project_type,$project_current_status,$project_layout,$project_logo,$image1,$image2,$image3,$image4,$image5,$image6,$image7,$image8,$image9,$image10,$video,$no_of_towers,$project_selling_status,$latitude,$longitude,$added,$project_facilities,$description,$date,$time);
				
				if($stmt_insert->execute())
				{
					$counter	=	0;
					$details	=	array();
					while($stmt_insert->fetch())
					{
						$details[$counter][0]	=	$id;
						$details[$counter][1]	=	$project_name;
						$details[$counter][2]	=	$project_address;
						$details[$counter][3]	=	$registration_no;
						$details[$counter][4]	=	$location;
						$details[$counter][5]	=	$project_type;
						$details[$counter][6]	=	$project_current_status;
						$details[$counter][7]	=	$project_layout;
						$details[$counter][8]	=	$project_logo;
						$details[$counter][9]	=	$image1;
						$details[$counter][10]	=	$image2;
						$details[$counter][11]	=	$image3;
						$details[$counter][12]	=	$image4;						
						$details[$counter][13]	=	$image5;
						$details[$counter][14]	=	$image6;
						$details[$counter][15]	=	$image7;
						$details[$counter][16]	=	$image8;
						$details[$counter][17]	=	$image9;
						$details[$counter][18]	=	$image10;
						$details[$counter][19]	=	$video;
						$details[$counter][20]	=	$no_of_towers;
						$details[$counter][21]	=	$project_selling_status;
						$details[$counter][22]	=	$latitude;						
						$details[$counter][23]	=	$longitude;
						$details[$counter][24]	=	$added;
						$details[$counter][25]	=	$project_facilities;
						$details[$counter][26]	=	$description;
						$details[$counter][27]	=	$date;
						$details[$counter][28]	=	$time;
					
						$counter++;
					}
					if(!empty($details))	
					{
						return $details;
					}
					return false;
				}	
			}
		}
		
		
		// function get_all_add_measurement()
		// {
		// 	if($stmt_insert = $this->con->prepare("SELECT `id`, `measurement_for`, `customer_name`, `shirt1`, `shirt2`, `shirt3`, `shirt4`, `shirt5`, `shirt6`, `shirt7`, `shirt8`, `shirt9`, `shirt10`, `shirt11`, `shirt12`, `shirt13`, `shirt14`, `shirt15`, `shirt16`, `shirt17`, `shirt18`, `cup_size`, `cup_style`, `shirt_style`, `shirt_size`, `patti`, `shirt_design`, `shirt_remark`, `pant1`, `pant2`, `pant3`, `pant4`, `pant5`, `pant6`, `pant7`, `pant8`, `pant9`, `pant10`, `pant11`, `pant12`, `pocket_size`, `back_pocket`, `watch_pocket`, `mobile_pocket`, `bottom_style`, `plate`, `pocket`, `iron`, `stiching`, `pant_remark`, `date`, `time` FROM `shirt_measurement` order by id ASC"))
		// 	{	
		// 		$stmt_insert->bind_result($id,$measurement_for,$customer_name,$shirt1,$shirt2,$shirt3,$shirt4,$shirt5,$shirt6,$shirt7,$shirt8,$shirt9,$shirt10,$shirt11,$shirt12,$shirt13,$shirt14,$shirt15,$shirt16,$shirt17,$shirt18,$cup_size,$cup_style,$shirt_style,$shirt_size,$patti,$shirt_design,$shirt_remark,$pant1,$pant2,$pant3,$pant4,$pant5,$pant6,$pant7,$pant8,$pant9,$pant10,$pant11,$pant12,$pocket_size,$back_pocket,$watch_pocket,$mobile_pocket,$bottom_style,$plate,$pocket,$iron,$stiching,$pant_remark,$date,$time);
				
		// 		if($stmt_insert->execute())
		// 		{
		// 			$counter	=	0;
		// 			$details	=	array();
		// 			while($stmt_insert->fetch())
		// 			{
		// 				$details[$counter][0]	=	$id;
		// 				$details[$counter][1]	=	$measurement_for;
		// 				$details[$counter][2]	=	$customer_name;
		// 				$details[$counter][3]	=	$shirt1;
		// 				$details[$counter][4]	=	$shirt2;
		// 				$details[$counter][5]	=	$shirt3;
		// 				$details[$counter][6]	=	$shirt4;
		// 				$details[$counter][7]	=	$shirt5;
		// 				$details[$counter][8]	=	$shirt6;
		// 				$details[$counter][9]	=	$shirt7;
		// 				$details[$counter][10]	=	$shirt8;
		// 				$details[$counter][11]	=	$shirt9;
		// 				$details[$counter][12]	=	$shirt10;
		// 				$details[$counter][13]	=	$shirt11;
		// 				$details[$counter][14]	=	$shirt12;
		// 				$details[$counter][15]	=	$shirt13;
		// 				$details[$counter][16]	=	$shirt14;
		// 				$details[$counter][17]	=	$shirt15;
		// 				$details[$counter][18]	=	$shirt16;
		// 				$details[$counter][19]	=	$shirt17;
		// 				$details[$counter][20]	=	$shirt18;
		// 				$details[$counter][21]	=	$cup_size;
		// 				$details[$counter][22]	=	$cup_style;
		// 				$details[$counter][23]	=	$shirt_style;
		// 				$details[$counter][24]	=	$shirt_size;
		// 				$details[$counter][25]	=	$patti;
		// 				$details[$counter][26]	=	$shirt_design;
		// 				$details[$counter][27]	=	$shirt_remark;
		// 				$details[$counter][28]	=	$pant1;
		// 				$details[$counter][29]	=	$pant2;
		// 				$details[$counter][30]	=	$pant3;
		// 				$details[$counter][31]	=	$pant4;
		// 				$details[$counter][32]	=	$pant5;
		// 				$details[$counter][33]	=	$pant6;
		// 				$details[$counter][34]	=	$pant7;
		// 				$details[$counter][35]	=	$pant8;
		// 				$details[$counter][36]	=	$pant9;
		// 				$details[$counter][37]	=	$pant10;
		// 				$details[$counter][38]	=	$pant11;
		// 				$details[$counter][39]	=	$pant12;
		// 				$details[$counter][40]	=	$pocket_size;
		// 				$details[$counter][41]	=	$back_pocket;
		// 				$details[$counter][42]	=	$watch_pocket;
		// 				$details[$counter][43]	=	$mobile_pocket;
		// 				$details[$counter][44]	=	$bottom_style;
		// 				$details[$counter][45]	=	$plate;
		// 				$details[$counter][46]	=	$pocket;
		// 				$details[$counter][47]	=	$iron;
		// 				$details[$counter][48]	=	$stiching;
		// 				$details[$counter][49]	=	$pant_remark;
		// 				$details[$counter][50]	=	$date;
		// 				$details[$counter][51]	=	$time;
						
		// 				$counter++;
		// 			}
		// 			if(!empty($details))	
		// 			{
		// 				return $details;
		// 			}
		// 			return false;
		// 		}	
		// 	}
		// }

		function get_all_pending_measurements()
		{
			if($stmt_insert = $this->con->prepare("SELECT id, measurement_for, customer_name, shirt1, shirt2, shirt3, shirt4, shirt5, shirt6, shirt7, shirt8, shirt9, shirt10, shirt11, shirt12, shirt13, shirt14, shirt15, shirt16, shirt17, shirt18, cup_size, cup_style, shirt_style, shirt_size, patti, shirt_design, shirt_remark, pant1, pant2, pant3, pant4, pant5, pant6, pant7, pant8, pant9, pant10, pant11, pant12, pocket_size, back_pocket, watch_pocket, mobile_pocket, bottom_style, plate, pocket, iron, stiching, pant_remark, mobile_number, delivery_date, total_amount, discount, payable_amount, paid_amount, balance_amount, delivery_status, payment_method, date, time FROM shirt_measurement WHERE `delivery_status`='Pending' order by id ASC"))
			{	
				$stmt_insert->bind_result($id,$measurement_for,$customer_name,$shirt1,$shirt2,$shirt3,$shirt4,$shirt5,$shirt6,$shirt7,$shirt8,$shirt9,$shirt10,$shirt11,$shirt12,$shirt13,$shirt14,$shirt15,$shirt16,$shirt17,$shirt18,$cup_size,$cup_style,$shirt_style,$shirt_size,$patti,$shirt_design,$shirt_remark,$pant1,$pant2,$pant3,$pant4,$pant5,$pant6,$pant7,$pant8,$pant9,$pant10,$pant11,$pant12,$pocket_size,$back_pocket,$watch_pocket,$mobile_pocket,$bottom_style,$plate,$pocket,$iron,$stiching,$pant_remark,$mobile_number,$delivery_date,$total_amount,$discount,$payable_amount,$paid_amount,$balance_amount,$delivery_status,$payment_method,$date,$time);
				
				if($stmt_insert->execute())
				{
					$counter	=	0;
					$details	=	array();
					while($stmt_insert->fetch())
					{
						$details[$counter][0]	=	$id;
						$details[$counter][1]	=	$measurement_for;
						$details[$counter][2]	=	$customer_name;
						$details[$counter][3]	=	$shirt1;
						$details[$counter][4]	=	$shirt2;
						$details[$counter][5]	=	$shirt3;
						$details[$counter][6]	=	$shirt4;
						$details[$counter][7]	=	$shirt5;
						$details[$counter][8]	=	$shirt6;
						$details[$counter][9]	=	$shirt7;
						$details[$counter][10]	=	$shirt8;
						$details[$counter][11]	=	$shirt9;
						$details[$counter][12]	=	$shirt10;
						$details[$counter][13]	=	$shirt11;
						$details[$counter][14]	=	$shirt12;
						$details[$counter][15]	=	$shirt13;
						$details[$counter][16]	=	$shirt14;
						$details[$counter][17]	=	$shirt15;
						$details[$counter][18]	=	$shirt16;
						$details[$counter][19]	=	$shirt17;
						$details[$counter][20]	=	$shirt18;
						$details[$counter][21]	=	$cup_size;
						$details[$counter][22]	=	$cup_style;
						$details[$counter][23]	=	$shirt_style;
						$details[$counter][24]	=	$shirt_size;
						$details[$counter][25]	=	$patti;
						$details[$counter][26]	=	$shirt_design;
						$details[$counter][27]	=	$shirt_remark;
						$details[$counter][28]	=	$pant1;
						$details[$counter][29]	=	$pant2;
						$details[$counter][30]	=	$pant3;
						$details[$counter][31]	=	$pant4;
						$details[$counter][32]	=	$pant5;
						$details[$counter][33]	=	$pant6;
						$details[$counter][34]	=	$pant7;
						$details[$counter][35]	=	$pant8;
						$details[$counter][36]	=	$pant9;
						$details[$counter][37]	=	$pant10;
						$details[$counter][38]	=	$pant11;
						$details[$counter][39]	=	$pant12;
						$details[$counter][40]	=	$pocket_size;
						$details[$counter][41]	=	$back_pocket;
						$details[$counter][42]	=	$watch_pocket;
						$details[$counter][43]	=	$mobile_pocket;
						$details[$counter][44]	=	$bottom_style;
						$details[$counter][45]	=	$plate;
						$details[$counter][46]	=	$pocket;
						$details[$counter][47]	=	$iron;
						$details[$counter][48]	=	$stiching;
						$details[$counter][49]	=	$pant_remark;
						$details[$counter][50]	=	$mobile_number;
						$details[$counter][51]	=	$delivery_date;
						$details[$counter][52]	=	$total_amount;
						$details[$counter][53]	=	$discount;
						$details[$counter][54]	=	$payable_amount;
						$details[$counter][55]	=	$paid_amount;
						$details[$counter][56]	=	$balance_amount;
						$details[$counter][57]	=	$delivery_status;
						$details[$counter][58]	=	$payment_method;
						$details[$counter][59]	=	$date;
						$details[$counter][60]	=	$time;
						
						
						$counter++;
					}
					if(!empty($details))	
					{
						return $details;
					}
					return false;
				}	
			}
		}
		
		function get_measurements_data_from_mobile_no($user_mobile_no)
		{
			if($stmt_insert = $this->con->prepare("SELECT id, measurement_for, customer_name, shirt1, shirt2, shirt3, shirt4, shirt5, shirt6, shirt7, shirt8, shirt9, shirt10, shirt11, shirt12, shirt13, shirt14, shirt15, shirt16, shirt17, shirt18, cup_size, cup_style, shirt_style, shirt_size, patti, shirt_design, shirt_remark, pant1, pant2, pant3, pant4, pant5, pant6, pant7, pant8, pant9, pant10, pant11, pant12, pocket_size, back_pocket, watch_pocket, mobile_pocket, bottom_style, plate, pocket, iron, stiching, pant_remark, mobile_number, delivery_date, total_amount, discount, payable_amount, paid_amount, balance_amount, delivery_status, payment_method, date, time FROM shirt_measurement WHERE `mobile_number`=? order by id DESC"))
			{	
			    $stmt_insert->bind_param("s",$user_mobile_no);
			    
				$stmt_insert->bind_result($id,$measurement_for,$customer_name,$shirt1,$shirt2,$shirt3,$shirt4,$shirt5,$shirt6,$shirt7,$shirt8,$shirt9,$shirt10,$shirt11,$shirt12,$shirt13,$shirt14,$shirt15,$shirt16,$shirt17,$shirt18,$cup_size,$cup_style,$shirt_style,$shirt_size,$patti,$shirt_design,$shirt_remark,$pant1,$pant2,$pant3,$pant4,$pant5,$pant6,$pant7,$pant8,$pant9,$pant10,$pant11,$pant12,$pocket_size,$back_pocket,$watch_pocket,$mobile_pocket,$bottom_style,$plate,$pocket,$iron,$stiching,$pant_remark,$mobile_number,$delivery_date,$total_amount,$discount,$payable_amount,$paid_amount,$balance_amount,$delivery_status,$payment_method,$date,$time);
				
				if($stmt_insert->execute())
				{
					$details	=	array();
					if($stmt_insert->fetch())
					{
						$details[0]	=	$id;
						$details[1]	=	$measurement_for;
						$details[2]	=	$customer_name;
						$details[3]	=	$shirt1;
						$details[4]	=	$shirt2;
						$details[5]	=	$shirt3;
						$details[6]	=	$shirt4;
						$details[7]	=	$shirt5;
						$details[8]	=	$shirt6;
						$details[9]	=	$shirt7;
						$details[10]	=	$shirt8;
						$details[11]	=	$shirt9;
						$details[12]	=	$shirt10;
						$details[13]	=	$shirt11;
						$details[14]	=	$shirt12;
						$details[15]	=	$shirt13;
						$details[16]	=	$shirt14;
						$details[17]	=	$shirt15;
						$details[18]	=	$shirt16;
						$details[19]	=	$shirt17;
						$details[20]	=	$shirt18;
						$details[21]	=	$cup_size;
						$details[22]	=	$cup_style;
						$details[23]	=	$shirt_style;
						$details[24]	=	$shirt_size;
						$details[25]	=	$patti;
						$details[26]	=	$shirt_design;
						$details[27]	=	$shirt_remark;
						$details[28]	=	$pant1;
						$details[29]	=	$pant2;
						$details[30]	=	$pant3;
						$details[31]	=	$pant4;
						$details[32]	=	$pant5;
						$details[33]	=	$pant6;
						$details[34]	=	$pant7;
						$details[35]	=	$pant8;
						$details[36]	=	$pant9;
						$details[37]	=	$pant10;
						$details[38]	=	$pant11;
						$details[39]	=	$pant12;
						$details[40]	=	$pocket_size;
						$details[41]	=	$back_pocket;
						$details[42]	=	$watch_pocket;
						$details[43]	=	$mobile_pocket;
						$details[44]	=	$bottom_style;
						$details[45]	=	$plate;
						$details[46]	=	$pocket;
						$details[47]	=	$iron;
						$details[48]	=	$stiching;
						$details[49]	=	$pant_remark;
						$details[50]	=	$mobile_number;
						$details[51]	=	$delivery_date;
						$details[52]	=	$total_amount;
						$details[53]	=	$discount;
						$details[54]	=	$payable_amount;
						$details[55]	=	$paid_amount;
						$details[56]	=	$balance_amount;
						$details[57]	=	$delivery_status;
						$details[58]	=	$payment_method;
						$details[59]	=	$date;
						$details[60]	=	$time;
						
						return $details;
					}

					return false;
				}	
			}
		}

		function get_all_approved_measurements()
		{
			if($stmt_insert = $this->con->prepare("SELECT id, measurement_for, customer_name, shirt1, shirt2, shirt3, shirt4, shirt5, shirt6, shirt7, shirt8, shirt9, shirt10, shirt11, shirt12, shirt13, shirt14, shirt15, shirt16, shirt17, shirt18, cup_size, cup_style, shirt_style, shirt_size, patti, shirt_design, shirt_remark, pant1, pant2, pant3, pant4, pant5, pant6, pant7, pant8, pant9, pant10, pant11, pant12, pocket_size, back_pocket, watch_pocket, mobile_pocket, bottom_style, plate, pocket, iron, stiching, pant_remark, mobile_number, delivery_date, total_amount, discount, payable_amount, paid_amount, balance_amount, delivery_status, payment_method, date, time FROM shirt_measurement WHERE `delivery_status`='Completed' order by id ASC"))
			{	
				$stmt_insert->bind_result($id,$measurement_for,$customer_name,$shirt1,$shirt2,$shirt3,$shirt4,$shirt5,$shirt6,$shirt7,$shirt8,$shirt9,$shirt10,$shirt11,$shirt12,$shirt13,$shirt14,$shirt15,$shirt16,$shirt17,$shirt18,$cup_size,$cup_style,$shirt_style,$shirt_size,$patti,$shirt_design,$shirt_remark,$pant1,$pant2,$pant3,$pant4,$pant5,$pant6,$pant7,$pant8,$pant9,$pant10,$pant11,$pant12,$pocket_size,$back_pocket,$watch_pocket,$mobile_pocket,$bottom_style,$plate,$pocket,$iron,$stiching,$pant_remark,$mobile_number,$delivery_date,$total_amount,$discount,$payable_amount,$paid_amount,$balance_amount,$delivery_status,$payment_method,$date,$time);
				
				if($stmt_insert->execute())
				{
					$counter	=	0;
					$details	=	array();
					while($stmt_insert->fetch())
					{
						$details[$counter][0]	=	$id;
						$details[$counter][1]	=	$measurement_for;
						$details[$counter][2]	=	$customer_name;
						$details[$counter][3]	=	$shirt1;
						$details[$counter][4]	=	$shirt2;
						$details[$counter][5]	=	$shirt3;
						$details[$counter][6]	=	$shirt4;
						$details[$counter][7]	=	$shirt5;
						$details[$counter][8]	=	$shirt6;
						$details[$counter][9]	=	$shirt7;
						$details[$counter][10]	=	$shirt8;
						$details[$counter][11]	=	$shirt9;
						$details[$counter][12]	=	$shirt10;
						$details[$counter][13]	=	$shirt11;
						$details[$counter][14]	=	$shirt12;
						$details[$counter][15]	=	$shirt13;
						$details[$counter][16]	=	$shirt14;
						$details[$counter][17]	=	$shirt15;
						$details[$counter][18]	=	$shirt16;
						$details[$counter][19]	=	$shirt17;
						$details[$counter][20]	=	$shirt18;
						$details[$counter][21]	=	$cup_size;
						$details[$counter][22]	=	$cup_style;
						$details[$counter][23]	=	$shirt_style;
						$details[$counter][24]	=	$shirt_size;
						$details[$counter][25]	=	$patti;
						$details[$counter][26]	=	$shirt_design;
						$details[$counter][27]	=	$shirt_remark;
						$details[$counter][28]	=	$pant1;
						$details[$counter][29]	=	$pant2;
						$details[$counter][30]	=	$pant3;
						$details[$counter][31]	=	$pant4;
						$details[$counter][32]	=	$pant5;
						$details[$counter][33]	=	$pant6;
						$details[$counter][34]	=	$pant7;
						$details[$counter][35]	=	$pant8;
						$details[$counter][36]	=	$pant9;
						$details[$counter][37]	=	$pant10;
						$details[$counter][38]	=	$pant11;
						$details[$counter][39]	=	$pant12;
						$details[$counter][40]	=	$pocket_size;
						$details[$counter][41]	=	$back_pocket;
						$details[$counter][42]	=	$watch_pocket;
						$details[$counter][43]	=	$mobile_pocket;
						$details[$counter][44]	=	$bottom_style;
						$details[$counter][45]	=	$plate;
						$details[$counter][46]	=	$pocket;
						$details[$counter][47]	=	$iron;
						$details[$counter][48]	=	$stiching;
						$details[$counter][49]	=	$pant_remark;
						$details[$counter][50]	=	$mobile_number;
						$details[$counter][51]	=	$delivery_date;
						$details[$counter][52]	=	$total_amount;
						$details[$counter][53]	=	$discount;
						$details[$counter][54]	=	$payable_amount;
						$details[$counter][55]	=	$paid_amount;
						$details[$counter][56]	=	$balance_amount;
						$details[$counter][57]	=	$delivery_status;
						$details[$counter][58]	=	$payment_method;
						$details[$counter][59]	=	$date;
						$details[$counter][60]	=	$time;
						
						
						$counter++;
					}
					if(!empty($details))	
					{
						return $details;
					}
					return false;
				}	
			}
		}

		function get_all_user_payment_entry()
		{
			if($stmt_insert = $this->con->prepare("SELECT `id`, `receipt_id`, `shirt_price`, `pant_price`, `total_amount`, `discount_amount`, `payable_amount`, `paid_amount`, `balance_amount`, `date`, `time` FROM `user_payment`"))
			{	
				$stmt_insert->bind_result($id,$receipt_id,$shirt_price,$pant_price,$total_amount,$discount_amount,$payable_amount,$paid_amount,$balance_amount,$date,$time);
				
				if($stmt_insert->execute())
				{
					$counter	=	0;
					$details	=	array();
					while($stmt_insert->fetch())
					{
						$details[$counter][0]	=	$id;
						$details[$counter][1]	=	$receipt_id;
						$details[$counter][2]	=	$shirt_price;				
						$details[$counter][3]	=	$pant_price;
						$details[$counter][4]	=	$total_amount;
						$details[$counter][5]	=	$discount_amount;
						$details[$counter][6]	=	$payable_amount;
						$details[$counter][7]	=	$paid_amount;
						$details[$counter][8]	=	$balance_amount;
						$details[$counter][9]	=	$date;
						$details[$counter][10]	=	$time;
						
						$counter++;
					}
					if(!empty($details))	
					{
						return $details;
					}
					return false;
				}	
			}
		}
		function get_all_tailor_master_records($master_category)
		{
			if($stmt_insert = $this->con->prepare("SELECT `id`, `category`, `title`, `date`, `time` FROM `tailor_master` WHERE `category`='$master_category ' "))
			{	
				$stmt_insert->bind_result($id,$master_category,$title,$date,$time);
				
				if($stmt_insert->execute())
				{
					$counter	=	0;
					$details	=	array();
					while($stmt_insert->fetch())
					{
						$details[$counter][0]	=	$id;
						$details[$counter][1]	=	$master_category;
						$details[$counter][2]	=	$title;
						$details[$counter][3]	=	$date;
						$details[$counter][4]	=	$time;
						
						$counter++;
					}
					if(!empty($details))	
					{
						return $details;
					}
					return false;
				}	
			}
		}
		
		
		function get_all_plot_project()
		{
			if($stmt_insert = $this->con->prepare("SELECT `id`, `project_id`, `plot_owener`, `enter_floor_no`, `unit_no`, `unit_label`, `sq_mtr`, `sq_ft`, `lambi`, `rundi`, `plot_status`, `unit_type`, `select_bhk`, `carpet_area`, `bulit_up_area`, `saleable_area`, `facing`, `approximate_rate_per_sq_ft`, `latitude`, `longitude`, `phase`, `image1`, `image2`, `image3`, `image4`, `image5`, `date`, `time` FROM `plot_project`"))
			{	
				$stmt_insert->bind_result($id,$project_id,$plot_owener,$enter_floor_no,$unit_no,$unit_label,$sq_mtr,$sq_ft,$lambi,$rundi,$carpet_area,$bulit_up_area,$saleable_area,$facing,$approximate_rate_per_sq_ft,$latitude,$longitude,$phase,$plot_status,$unit_type,$select_bhk,$image1,$image2,$image3,$image4,$image5,$date,$time);
				
				if($stmt_insert->execute())
				{
					$counter	=	0;
					$details	=	array();
					while($stmt_insert->fetch())
					{
						$details[$counter][0]	=	$id;
						$details[$counter][1]	=	$project_id;
						$details[$counter][2]	=	$plot_owener;
						$details[$counter][3]	=	$enter_floor_no;
						$details[$counter][4]	=	$unit_no;
						$details[$counter][5]	=	$unit_label;
						$details[$counter][6]	=	$sq_mtr;
						$details[$counter][7]	=	$sq_ft;
						$details[$counter][8]	=	$lambi;
						$details[$counter][9]	=	$rundi;
						$details[$counter][10]	=	$plot_status;
						$details[$counter][11]	=	$unit_type;
						$details[$counter][12]	=	$select_bhk;
						$details[$counter][13]	=	$carpet_area;
						$details[$counter][14]	=	$bulit_up_area;
						$details[$counter][15]	=	$saleable_area;
						$details[$counter][16]	=	$facing;
						$details[$counter][17]	=	$approximate_rate_per_sq_ft;
						$details[$counter][18]	=	$latitude;
						$details[$counter][19]	=	$longitude;
						$details[$counter][20]	=	$phase;
						$details[$counter][21]	=	$image1;
						$details[$counter][22]	=	$image2;
						$details[$counter][23]	=	$image3;
						$details[$counter][24]	=	$image4;
						$details[$counter][25]	=	$image5;
						$details[$counter][26]	=	$date;
						$details[$counter][27]	=	$time;
					
						$counter++;
					}
					if(!empty($details))	
					{
						return $details;
					}
					return false;
				}	
			}
		}
		
		function get_all_booking_project()
		{
			if($stmt_insert = $this->con->prepare("SELECT `id`, `booking_date`, `select_project`, `unit_no`, `size_sq_ft`, `rate_sq_ft`, `total_amount`, `discount`, `rate_after_discount`, `round_off`, `net_amount`, `load_from_leads_data`, `mobile_no`, `custamer_name`, `email_id`, `address`, `pincode`, `dob`, `nominee`, `age_of_nominee`, `payment_type`, `adhar_number`, `PAN_card`, `adhar_card_image`, `PAN_card_image`, `customer_photo_adhar_card`, `cash_receipt_PAN_card_image`, `customer_image`, `cash_receipt`, `sold_by`, `commission`, `plat_status`, `remark`, `date`, `time` FROM `bookings`"))
			{	
				$stmt_insert->bind_result($res_id,$booking_date,$select_project,$unit_no,$size_sq_ft,$rate_sq_ft,$total_amount,$discount,$rate_after_discount,$round_off,$net_amount,$load_from_leads_data,$mobile_no,$custamer_name,$email_id,$address,$pincode,$dob,$nominee,$age_of_nominee,$payment_type,$adhar_number,$PAN_card,$adhar_card_image,$PAN_card_image,$customer_photo_adhar_card,$cash_receipt_PAN_card_image,$customer_image,$cash_receipt,$sold_by,$commission,$plat_status,$remark,$date,$time);
				
				if($stmt_insert->execute())
				{
					$counter	=	0;
					$details	=	array();
					while($stmt_insert->fetch())
					{
						$details[$counter][0]	=	$res_id;
						$details[$counter][1]	=	$booking_date;
						$details[$counter][2]	=	$select_project;
						$details[$counter][3]	=	$unit_no;
						$details[$counter][4]	=	$size_sq_ft;
						$details[$counter][5]	=	$rate_sq_ft;
						$details[$counter][6]	=	$total_amount;
						$details[$counter][7]	=	$discount;
						$details[$counter][8]	=	$rate_after_discount;
						$details[$counter][9]	=	$round_off;
						$details[$counter][10]	=	$net_amount;
						$details[$counter][11]	=	$load_from_leads_data;
						$details[$counter][12]	=	$mobile_no;
						$details[$counter][13]	=	$custamer_name;
						$details[$counter][14]	=	$email_id;
						$details[$counter][15]	=	$address;
						$details[$counter][16]	=	$pincode;
						$details[$counter][17]	=	$dob;
						$details[$counter][18]	=	$nominee;
						$details[$counter][19]	=	$age_of_nominee;
						$details[$counter][20]	=	$payment_type;
						$details[$counter][21]	=	$adhar_number;
						$details[$counter][22]	=	$PAN_card;
						$details[$counter][23]	=	$adhar_card_image;
						$details[$counter][24]	=	$PAN_card_image;
						$details[$counter][25]	=	$customer_photo_adhar_card;
						$details[$counter][26]	=	$cash_receipt_PAN_card_image;
						$details[$counter][27]	=	$customer_image;
						$details[$counter][28]	=	$cash_receipt;
						$details[$counter][29]	=	$sold_by;
						$details[$counter][30]	=	$commission;
						$details[$counter][31]	=	$plat_status;
						$details[$counter][32]	=	$remark;
						$details[$counter][33]	=	$date;
						$details[$counter][34]	=	$time;
					
						$counter++;
					}
					if(!empty($details))	
					{
						return $details;
					}
					return false;
				}	
			}
		}
		
		function get_all_payment_project()
		{
			if($stmt_insert = $this->con->prepare("SELECT `id`, `received_date`, `receipt_no`, `manual_receipt_no`, `type_of_payment`, `payment_mode`, `amount`, `remark`, `date`, `time` FROM `payment`"))
			{	
				$stmt_insert->bind_result($id,$received_date,$receipt_no,$manual_receipt_no,$type_of_payment,$payment_mode,$amount,$remark,$date,$time);
				
				if($stmt_insert->execute())
				{
					$counter	=	0;
					$details	=	array();
					while($stmt_insert->fetch())
					{
						$details[$counter][0]	=	$id;
						$details[$counter][1]	=	$received_date;
						$details[$counter][2]	=	$receipt_no;
						$details[$counter][3]	=	$manual_receipt_no;
						$details[$counter][4]	=	$type_of_payment;
						$details[$counter][5]	=	$payment_mode;
						$details[$counter][6]	=	$amount;
						$details[$counter][7]	=	$remark;
						$details[$counter][8]	=	$date;
						$details[$counter][9]	=	$time;
					
						$counter++;
					}
					if(!empty($details))	
					{
						return $details;
					}
					return false;
				}	
			}
		}
		
		function get_all_enquiry_project()
		{
			if($stmt_insert = $this->con->prepare("SELECT `id`, `project_id`, `plot_no`, `full_name`, `dob`, `mobile_no1`, `mobile_no2`, `email`, `address`, `occupation`, `resource`, `property_space`, `property_type`, `description`, `status`, `date`, `time` FROM `enquiry_form`"))
			{	
				$stmt_insert->bind_result($res_id,$project_id,$plot_no,$full_name,$dob,$mobile_no1,$mobile_no2,$email,$address,$occupation,$resource,$property_space,$property_type,$description,$status,$date,$time);
				
				if($stmt_insert->execute())
				{
					$counter	=	0;
					$details	=	array();
					while($stmt_insert->fetch())
					{
						
						$details[$counter][0]	=	$res_id;
						$details[$counter][1]	=	$project_id;
						$details[$counter][2]	=	$plot_no;
						$details[$counter][3]	=	$full_name;
						$details[$counter][4]	=	$dob;
						$details[$counter][5]	=	$mobile_no1;
						$details[$counter][6]	=	$mobile_no2;
						$details[$counter][7]	=	$email;
						$details[$counter][8]	=	$address;
						$details[$counter][9]	=	$occupation;
						$details[$counter][10]	=	$resource;
						$details[$counter][11]	=	$property_space;
						$details[$counter][12]	=	$property_type;
						$details[$counter][13]	=	$description;
						$details[$counter][14]	=	$status;
						$details[$counter][15]	=	$date;
						$details[$counter][16]	=	$time;					
					
						$counter++;
					}
					if(!empty($details))	
					{
						return $details;
					}
					return false;
				}	
			}
		}
		
		function get_all_workers_work()
		{
			if($stmt_insert = $this->con->prepare("SELECT `id`, `workers`, `delivery_date`, `remark`, `date`, `time`,`receipt_id` FROM `assigned_work`"))
			{	
				$stmt_insert->bind_result($res_id,$workers,$delivery_date,$remark,$date,$time,$receipt_id);
				
				if($stmt_insert->execute())
				{
					$counter	=	0;
					$details	=	array();
					while($stmt_insert->fetch())
					{
						
						$details[$counter][0]	=	$res_id;
						$details[$counter][1]	=	$workers;
						$details[$counter][2]	=	$delivery_date;
						$details[$counter][3]	=	$remark;
						$details[$counter][4]	=	$date;
						$details[$counter][5]	=	$time;
						$details[$counter][6]	=	$receipt_id;
					
						$counter++;
					}
					if(!empty($details))	
					{
						return $details;
					}
					return false;
				}	
			}
		}

		function get_all_workers_payment()
		{
			if($stmt_insert = $this->con->prepare("SELECT `id`, `name`, `amount`, `payment_method`, `remark`, `date`, `time` FROM `worker-payment`"))
			{	
				$stmt_insert->bind_result($res_id,$workers,$amount,$payment_method,$remark,$date,$time);
				
				if($stmt_insert->execute())
				{
					$counter	=	0;
					$details	=	array();
					while($stmt_insert->fetch())
					{
						
						$details[$counter][0]	=	$res_id;
						$details[$counter][1]	=	$workers;
						$details[$counter][2]	=	$amount;
						$details[$counter][3]	=	$payment_method;
						$details[$counter][4]	=	$remark;						
						$details[$counter][5]	=	$date;
						$details[$counter][6]	=	$time;					
					
						$counter++;
					}
					if(!empty($details))	
					{
						return $details;
					}
					return false;
				}	
			}
		}
		
		function get_all_payment_schedule()
		{
			if($stmt_insert = $this->con->prepare("SELECT `id`, `customer_id`, `net_amount`, `payment_schedule_date`, `payment_amount`, `date`, `time` FROM `payment_schedule`"))
			{	
				$stmt_insert->bind_result($id,$customer_id,$net_amount,$payment_schedule_date,$payment_amount,$date,$time);
				
				if($stmt_insert->execute())
				{
					$counter	=	0;
					$details	=	array();
					while($stmt_insert->fetch())
					{
						$details[$counter][0]	=	$id;
						$details[$counter][1]	=	$customer_id;
						$details[$counter][2]	=	$net_amount;
						$details[$counter][3]	=	$payment_schedule_date;
						$details[$counter][4]	=	$payment_amount;
						$details[$counter][5]	=	$date;
						$details[$counter][6]	=	$time;
					
						$counter++;
					}
					if(!empty($details))	
					{
						return $details;
					}
					return false;
				}	
			}
		}
		
		function get_all_sample_type_group_names()
		{
			if($stmt_insert = $this->con->prepare("SELECT `id`, `group_name`, `date`, `time`, `sample_type_name` FROM `sample_types`"))
			{	
				$stmt_insert->bind_result($id,$group_name,$date,$time,$sample_type_name);
				
				if($stmt_insert->execute())
				{
					$counter	=	0;
					$details	=	array();
					while($stmt_insert->fetch())
					{
						$details[$counter][0]	=	$id;
						$details[$counter][1]	=	$group_name;
						$details[$counter][2]	=	$date;
						$details[$counter][3]	=	$time;
						$details[$counter][4]	=	$sample_type_name;
						
						$counter++;
					}
					if(!empty($details))	
					{
						return $details;
					}
					return false;
				}	
			}
		}
		
		function get_all_expenses_group_names()
		{
			if($stmt_insert = $this->con->prepare("SELECT `id`, `expenses`, `titel`, `expenses_date`, `expenses_amount`, `description`, `date`, `time` FROM `expenses`"))
			{	
				$stmt_insert->bind_result($id,$expenses_category,$titel,$expenses_date,$expenses_amount,$description,$date,$time);
				
				if($stmt_insert->execute())
				{
					$counter	=	0;
					$details	=	array();
					while($stmt_insert->fetch())
					{
						$details[$counter][0]	=	$id;
						$details[$counter][1]	=	$expenses_category;
						$details[$counter][2]	=	$titel;
						$details[$counter][3]	=	$expenses_date;
						$details[$counter][4]	=	$expenses_amount;
						$details[$counter][5]	=	$description;
						$details[$counter][6]	=	$date;
						$details[$counter][7]	=	$time;
						
						$counter++;
					}
					if(!empty($details))	
					{
						return $details;
					}
					return false;
				}	
			}
		}
		
		function get_all_standard_master_names()
		{
			if($stmt_insert = $this->con->prepare("SELECT `id`, `standard_name`, `standard_title`, `date`, `time` FROM `standard_master`"))
			{	
				$stmt_insert->bind_result($id,$test_name,$standard_title,$date,$time);
				
				if($stmt_insert->execute())
				{
					$counter	=	0;
					$details	=	array();
					while($stmt_insert->fetch())
					{
						$details[$counter][0]	=	$id;
						$details[$counter][1]	=	$test_name;
						$details[$counter][2]	=	$date;
						$details[$counter][3]	=	$time;
						$details[$counter][4]	=	$standard_title;
						
						$counter++;
					}
					if(!empty($details))	
					{
						return $details;
					}
					return false;
				}	
			}
		}
		function get_all_payment_schedules()
		{
			if($stmt_insert = $this->con->prepare("SELECT `id`, `customer_id`, `net_amount`, `payment_schedule_date`, `payment_amount`, `date`, `time` FROM `payment_schedule`"))
			{	
				$stmt_insert->bind_result($id,$customer_id,$net_amount,$payment_schedule_date,$payment_amount,$date,$time);
				
				if($stmt_insert->execute())
				{
					$counter	=	0;
					$details	=	array();
					while($stmt_insert->fetch())
					{
						$details[$counter][0]	=	$id;
						$details[$counter][1]	=	$customer_id;
						$details[$counter][2]	=	$net_amount;
						$details[$counter][3]	=	$payment_schedule_date;
						$details[$counter][4]	=	$payment_amount;
						$details[$counter][5]	=	$date;
						$details[$counter][6]	=	$time;
						
						$counter++;
					}
					if(!empty($details))	
					{
						return $details;
					}
					return false;
				}	
			}
		}
		
		function get_user_profile_data($current_login_emp_code)
		{
			if($stmt_insert = $this->con->prepare("SELECT `id`, `employee_code`, `full_name`, `email_id`, `mobile_no`, `designation`, `password`, `account_status`, `date`, `time` FROM `software_users` WHERE `employee_code`=?"))
			{	
				$stmt_insert->bind_param("s",$current_login_emp_code);
		
				$stmt_insert->bind_result($id,$employee_code,$full_name,$email_id,$mobile_no,$designation,$password,$account_status,$date,$time);
				
				if($stmt_insert->execute())
				{
					$details	=	array();
					if($stmt_insert->fetch())
					{
						$details[0]	=	$id;
						$details[1]	=	$employee_code;
						$details[2]	=	$full_name;
						$details[3]	=	$email_id;
						$details[4]	=	$mobile_no;
						$details[5]	=	$designation;
						$details[6]	=	$password;
						$details[7]	=	$account_status;
						$details[8]	=	$date;
						$details[9]	=	$time;
					}
					if(!empty($details))	
					{
						return $details;
					}
					return false;
				}
			}
		}
		
		function delete_group_name($del_id)
		{
			if($stmt_select = $this->con->prepare("Delete from `groups` where `id`=?"))
			{
				$stmt_select->bind_param("i",$del_id);
			
				if($stmt_select->execute())
				{					
						return true;
				}
					return false;
			}
		}
		function delete_expenses_name($del_id)
		{
			if($stmt_select = $this->con->prepare("DELETE FROM `expenses_category` WHERE `id`=?"))
			{
				$stmt_select->bind_param("i",$del_id);
			
				if($stmt_select->execute())
				{					
						return true;
				}
					return false;
			}
		}
		
		function delete_test_master($del_id)
		{
			if($stmt_select = $this->con->prepare("DELETE FROM `test_master` WHERE `id`=?"))
			{
				$stmt_select->bind_param("i",$del_id);
			
				if($stmt_select->execute())
				{					
						return true;
				}
					return false;
			}
		}
		
		function delete_software_user($del_id)
		{
			if($stmt_select = $this->con->prepare("Delete from `software_users` where `id`=?"))
			{
				$stmt_select->bind_param("i",$del_id);
			
				if($stmt_select->execute())
				{					
						return true;
				}
					return false;
			}
		}
		
		function delete_agent_user($del_id)
		{
			if($stmt_select = $this->con->prepare("DELETE FROM `agent` WHERE `id`=?"))
			{
				$stmt_select->bind_param("i",$del_id);
			
				if($stmt_select->execute())
				{					
						return true;
				}
					return false;
			}
		}
		
		function delete_customer_record($del_id)
		{
			if($stmt_select = $this->con->prepare("DELETE FROM `customer` WHERE `id`=?"))
			{
				$stmt_select->bind_param("i",$del_id);
			
				if($stmt_select->execute())
				{					
						return true;
				}
					return false;
			}
		}
		function delete_worker_record($del_id)
		{
			if($stmt_select = $this->con->prepare("DELETE FROM `worker` WHERE`id`=?"))
			{
				$stmt_select->bind_param("i",$del_id);
			
				if($stmt_select->execute())
				{					
						return true;
				}
					return false;
			}
		}
		
		function delete_client_details($del_id)
		{
			if($stmt_select = $this->con->prepare("Delete from `clients` where `id`=?"))
			{
				$stmt_select->bind_param("i",$del_id);
			
				if($stmt_select->execute())
				{					
						return true;
				}
					return false;
			}
		}
		
		function delete_inward_details($del_id)
		{
			if($stmt_select = $this->con->prepare("Delete from `inward` where `id`=?"))
			{
				$stmt_select->bind_param("i",$del_id);
			
				if($stmt_select->execute())
				{					
						return true;
				}
					return false;
			}
		}
		
		function delete_add_project($del_id)
		{
			if($stmt_select = $this->con->prepare("DELETE FROM `projects` WHERE `id`=?"))
			{
				$stmt_select->bind_param("i",$del_id);
			
				if($stmt_select->execute())
				{					
						return true;
				}
					return false;
			}
		}
		function delete_add_measurement($del_id)
		{
			if($stmt_select = $this->con->prepare("DELETE FROM `shirt_measurement` WHERE `id`=?"))
			{
				$stmt_select->bind_param("i",$del_id);
			
				if($stmt_select->execute())
				{					
						return true;
				}
					return false;
			}
		}
		function delete_tailor_master_title($del_id)
		{
			if($stmt_select = $this->con->prepare("DELETE FROM `tailor_master` WHERE `id`=?"))
			{
				$stmt_select->bind_param("i",$del_id);
			
				if($stmt_select->execute())
				{					
						return true;
				}
					return false;
			}
		}
		
		function delete_plot_record($del_id)
		{
			if($stmt_select = $this->con->prepare("DELETE FROM `plot_project` WHERE `id`=?"))
			{
				$stmt_select->bind_param("i",$del_id);
			
				if($stmt_select->execute())
				{					
						return true;
				}
					return false;
			}
		}
		function delete_booking_record($del_id)
		{
			if($stmt_select = $this->con->prepare("DELETE FROM `bookings` WHERE`id`=?"))
			{
				$stmt_select->bind_param("i",$del_id);
			
				if($stmt_select->execute())
				{					
						return true;
				}
					return false;
			}
		}
		function delete_payment_record($del_id)
		{
			if($stmt_select = $this->con->prepare("DELETE FROM `payment` WHERE`id`=?"))
			{
				$stmt_select->bind_param("i",$del_id);
			
				if($stmt_select->execute())
				{					
						return true;
				}
					return false;
			}
		}
		
		function delete_enquiry_record($del_id)
		{
			if($stmt_select = $this->con->prepare("DELETE FROM `enquiry_form` WHERE`id`=?"))
			{
				$stmt_select->bind_param("i",$del_id);
			
				if($stmt_select->execute())
				{					
						return true;
				}
					return false;
			}
		}
		
		function delete_work_record($del_id)
		{
			if($stmt_select = $this->con->prepare("DELETE FROM `assigned_work` WHERE`id`=?"))
			{
				$stmt_select->bind_param("i",$del_id);
			
				if($stmt_select->execute())
				{					
						return true;
				}
					return false;
			}
		}

		function delete_worker_payment_record($del_id)
		{
			if($stmt_select = $this->con->prepare("DELETE FROM `worker-payment` WHERE`id`=?"))
			{
				$stmt_select->bind_param("i",$del_id);
			
				if($stmt_select->execute())
				{					
						return true;
				}
					return false;
			}
		}
		
		function delete_payment_schedule_record($del_id)
		{
			if($stmt_select = $this->con->prepare("SELECT * FROM `payment_schedule` WHERE`id`=?"))
			{
				$stmt_select->bind_param("i",$del_id);
			
				if($stmt_select->execute())
				{					
						return true;
				}
					return false;
			}
		}
		
		function delete_sample_type_name($del_id)
		{
			if($stmt_select = $this->con->prepare("Delete from `sample_types` where `id`=?"))
			{
				$stmt_select->bind_param("i",$del_id);
			
				if($stmt_select->execute())
				{					
						return true;
				}
					return false;
			}
		}
		function delete_expenses($delete_id)
		{
			if($stmt_select = $this->con->prepare("DELETE FROM `expenses` WHERE `id`=?"))
			{
				$stmt_select->bind_param("i",$delete_id);
			
				if($stmt_select->execute())
				{					
						return true;
				}
					return false;
			}
		}
		
		
		
		
		function insert_sample_entry($var_LRN,$var_project_name,$var_client_name,$var_location,$var_sample_date,$var_bore_hole_type,$var_bh_no,$var_chainage_no,$var_sr_no,$var_type_of_sample,$var_sample_no,$var_sample_length_in_cm,$var_test_on_sample,$var_prepared_by,$var_approved_by,$var_bh_depth_m,$var_depth_m)
	{
		$current_date = date("Y-m-d");
		$current_time = date("H-i-s");
		
		if($stmt = 	$this->con->prepare("INSERT INTO `sample_list`(`LRN`, `project_name`, `client_name`, `location`, `sample_date`, `bore_hole_type`, `bh_no`, `chainage_no`, `sr_no`, `type_of_sample`, `sample_no`, `sample_length_in_cm`, `test_on_sample`, `prepared_by`, `approved_by`, `bh_depth_m`, `depth_m`, `date`, `time`) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"))
		{
			
			$stmt->bind_param("sssssssssssssssssss",$var_LRN,$var_project_name,$var_client_name,$var_location,$var_sample_date,$var_bore_hole_type,$var_bh_no,$var_chainage_no,$var_sr_no,$var_type_of_sample,$var_sample_no,$var_sample_length_in_cm,$var_test_on_sample,$var_prepared_by,$var_approved_by,$var_bh_depth_m,$var_depth_m,$current_date,$current_time);
			
			if($stmt->execute())
			{
				return true;
			}
			else
			{
			return false;
			}
		
		}
	}
	
		function get_sample_data ()
	{ 
		if($stmt = 	$this->con->prepare("SELECT `id`, `LRN`, `project_name`, `client_name`, `location`, `sample_date`, `bore_hole_type`, `bh_no`, `chainage_no`, `sr_no`, `type_of_sample`, `sample_no`, `sample_length_in_cm`, `test_on_sample`, `prepared_by`, `approved_by`,`bh_depth_m`,`depth_m`,`date`, `time` FROM `sample_list` "))
			
		{
			$stmt->bind_result($res_id,$res_LRN,$res_project_name,$res_client_name,$res_location,$res_sample_date,$res_bore_hole_type,$res_bh_no,$res_chainage_no,$res_sr_no,$res_type_of_sample,$res_sample_no,$res_sample_length_in_cm,$res_test_on_sample,$res_prepared_by,$res_approved_by,$res_bh_depth_m,$res_depth_m,$res_date,$res_time);
			
			if($stmt->execute())
			{ 
				$users_data = array();
				$counter = 0;
			}
			while($stmt->fetch())
			{ 
			$users_data[$counter]['id'] = $res_id;
			$users_data[$counter]['LRN'] = $res_LRN;
			$users_data[$counter]['project_name'] = $res_project_name;
			$users_data[$counter]['client_name'] = $res_client_name;
			$users_data[$counter]['location'] = $res_location;
			$users_data[$counter]['sample_date'] = $res_sample_date;
			$users_data[$counter]['bore_hole_type'] = $res_bore_hole_type;
			$users_data[$counter]['bh_no'] = $res_bh_no;
			$users_data[$counter]['chainage_no'] = $res_chainage_no;
			$users_data[$counter]['sr_no'] = $res_sr_no;
			$users_data[$counter]['type_of_sample'] = $res_type_of_sample;
			$users_data[$counter]['sample_no'] = $res_sample_no;
			$users_data[$counter]['sample_length_in_cm'] = $res_sample_length_in_cm;
			$users_data[$counter]['test_on_sample'] = $res_test_on_sample;
			$users_data[$counter]['prepared_by'] = $res_prepared_by;
			$users_data[$counter]['approved_by'] = $res_approved_by;
			$users_data[$counter]['bh_depth_m'] = $res_bh_depth_m;
			$users_data[$counter]['depth_m'] = $res_depth_m;
			$users_data[$counter]['date'] = $res_date;
			$users_data[$counter]['time'] = $res_time;
          	$counter++;
			
			}
			
			
			if(!empty($users_data))
			{
				
				return $users_data;
			} 
			else
			{
				return false;
			}
			
		}
		
	}
	 
	 function delete_sample_record($del_id)
	{
		if($stmt = $this->con->prepare("DELETE FROM `sample_list` where `id`=?"))
		{
			$stmt->bind_param("i",$del_id);
			
			if($stmt->execute())
			{
				return true;
			}
			else
			{
				return false;
			}
		}
	}
	
		function insert_client_request_entry($var_job_number,$var_client_entry_date,$var_lab_reference_number,$var_customer_name,$var_address,$var_project_name,$var_contact_person,$var_mobile_no,$var_GST_number,$var_PAN,$var_report_dispatch_mode,$var_sample_material,$var_quantity,$var_sr_no,$var_type_of_sample,$var_tests,$var_ref_standards,$var_statement_of_confirmity_required,$var_remarks,$var_sample_adequacy,$var_test_person_available,$var_test_with_NABL_scope,$var_source_adequacy,$var_condition_of_sample,$var_sample_inward_by,$var_instructions_from_customers,$var_test_contract_verified_by)
	{
		$current_date = date("Y-m-d");
		$current_time = date("H-i-s");
		
		if($stmt = 	$this->con->prepare("INSERT INTO `client_request`(`job_number`, `client_entry_date`, `lab_reference_number`, `customer_name`, `address`, `project_name`, `contact_person`, `mobile_no`, `GST_number`, `PAN`, `report_dispatch_mode`, `sample_material`, `quantity`, `sr_no`, `type_of_sample`, `tests`, `ref_standards`, `statement_of_confirmity_required`, `remarks`, `sample_adequacy`, `test_person_available`, `test_with_NABL_scope`, `source_adequacy`, `condition_of_sample`, `sample_inward_by`, `instructions_from_customers`, `test_contract_verified_by`, `date`, `time`, `sample_id_bh_no_trial_pit_no`, `location_chainage_no`, `depth_m`) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"))
		{
	
			$stmt->bind_param("sssssssssssssssssssssssssssss",$var_job_number,$var_client_entry_date,$var_lab_reference_number,$var_customer_name,$var_address,$var_project_name,$var_contact_person,$var_mobile_no,$var_GST_number,$var_PAN,$var_report_dispatch_mode,$var_sample_material,$var_quantity,$var_sr_no,$var_type_of_sample,$var_tests,$var_ref_standards,$var_statement_of_confirmity_required,$var_remarks,$var_sample_adequacy,$var_test_person_available,$var_test_with_NABL_scope,$var_source_adequacy,$var_condition_of_sample,$var_sample_inward_by,$var_instructions_from_customers,$var_test_contract_verified_by,$current_date,$current_time);
			
			if($stmt->execute())
			{
				return true;
			}
			else
			{
			return false;
			}
		
		}
	}
		
		function get_user_data()
	{ 
		if($stmt = 	$this->con->prepare("SELECT `id`, `job_number`, `client_entry_date`, `lab_reference_number`, `customer_name`, `address`, `project_name`, `contact_person`, `mobile_no`, `GST_number`, `PAN`, `report_dispatch_mode`, `sample_material`, `quantity`, `sr_no`, `type_of_sample`, `tests`, `ref_standards`, `statement_of_confirmity_required`, `remarks`, `sample_adequacy`, `test_person_available`, `test_with_NABL_scope`, `source_adequacy`, `condition_of_sample`, `sample_inward_by`, `instructions_from_customers`, `test_contract_verified_by`, `date`, `time` FROM `client_request` "))
			
		{
			$stmt->bind_result($res_id,$res_job_number,$res_client_entry_date,$res_lab_reference_number,$res_customer_name,$res_address,$res_project_name,$res_contact_person,$res_mobile_no,$res_GST_number,$res_PAN,$res_report_dispatch_mode,$res_sample_material,$res_quantity,$res_sr_no,$res_type_of_sample,$res_tests,$res_ref_standards,$res_statement_of_confirmity_required,$res_remarks,$res_sample_adequacy,$res_test_person_available,$res_test_with_NABL_scope,$res_source_adequacy,$res_condition_of_sample,$res_sample_inward_by,$res_instructions_from_customers,$res_test_contract_verified_by,$res_date,$res_time);
			
			if($stmt->execute())
			{ 
				$users_data = array();
				$counter = 0;
			}
			while($stmt->fetch())
			{ 
			$users_data[$counter]['id'] 							= $res_id;
			$users_data[$counter]['job_number'] 					= $res_job_number;
			$users_data[$counter]['client_entry_date'] 				= $res_client_entry_date;
			$users_data[$counter]['lab_reference_number'] 			= $res_lab_reference_number;
			$users_data[$counter]['customer_name']				    = $res_customer_name;
			$users_data[$counter]['address'] 						= $res_address;
			$users_data[$counter]['project_name'] 					= $res_project_name;
			$users_data[$counter]['contact_person'] 				= $res_contact_person;
			$users_data[$counter]['mobile_no'] 						= $res_mobile_no;
			$users_data[$counter]['GST_number'] 					= $res_GST_number;
			$users_data[$counter]['PAN'] 							= $res_PAN;
			$users_data[$counter]['report_dispatch_mode']		    = $res_report_dispatch_mode;
			$users_data[$counter]['sample_material'] 				= $res_sample_material;
			$users_data[$counter]['quantity'] 						= $res_quantity;
			$users_data[$counter]['sr_no'] 							= $res_sr_no;
			$users_data[$counter]['type_of_sample'] 				= $res_type_of_sample;
			$users_data[$counter]['tests'] 							= $res_tests;
			$users_data[$counter]['ref_standards'] 					= $res_ref_standards;
			$users_data[$counter]['statement_of_confirmity_required'] = $res_statement_of_confirmity_required;
			$users_data[$counter]['remarks'] 						= $res_remarks;
			$users_data[$counter]['sample_adequacy']			    = $res_sample_adequacy;
			$users_data[$counter]['test_person_available'] 			= $res_test_person_available;
			$users_data[$counter]['test_with_NABL_scope'] 			= $res_test_with_NABL_scope;
			$users_data[$counter]['source_adequacy'] 				= $res_source_adequacy;
			$users_data[$counter]['condition_of_sample'] 			= $res_condition_of_sample;
			$users_data[$counter]['sample_inward_by'] 				= $res_sample_inward_by;
			$users_data[$counter]['instructions_from_customers'] 	= $res_instructions_from_customers;
			$users_data[$counter]['test_contract_verified_by'] 		= $res_test_contract_verified_by;
			$users_data[$counter]['date']						    = $res_date;
			$users_data[$counter]['time'] 							= $res_time;
          	$counter++;
			
			}
			
			
			if(!empty($users_data))
			{
				
				return $users_data;
			} 
			else
			{
				return false;
			}
			
		}
		
	}
		function delete_client_request_record($del_id)
	{
		if($stmt = $this->con->prepare("DELETE FROM `client_request` WHERE  `id`=?"))
		{
			$stmt->bind_param("i",$del_id);
			
			if($stmt->execute())
			{
				return true;
			}
			else
			{
				return false;
			}
		}
	}
	
	
	function update_user_measurement($measurement_for,$customer_name,$shirt1,$shirt2,$shirt3,$shirt4,$shirt5,$shirt6,$shirt7,$shirt8,$shirt9,$shirt10,$shirt11,$shirt12,$shirt13,$shirt14,$shirt15,$shirt16,$shirt17,$shirt18,$cup_size,$cup_style,$shirt_style,$shirt_size,$patti,$shirt_design,$shirt_remark,$pant1,$pant2,$pant3,$pant4,$pant5,$pant6,$pant7,$pant8,$pant9,$pant10,$pant11,$pant12,$pocket_size,$back_pocket,$watch_pocket,$mobile_pocket,$bottom_style,$plate,$pocket,$iron,$stiching,$pant_remark,$mobile_number,$delivery_date,$res_edit_id)
		{ 
			$date = date("Y-m-d");
			$time = date("H-i-s A");
			
			if($stmt_insert = $this->con->prepare("UPDATE `shirt_measurement` SET `measurement_for`=?,`customer_name`=?,`shirt1`=?,`shirt2`=?,`shirt3`=?,`shirt4`=?,`shirt5`=?,`shirt6`=?,`shirt7`=?,`shirt8`=?,`shirt9`=?,`shirt10`=?,`shirt11`=?,`shirt12`=?,`shirt13`=?,`shirt14`=?,`shirt15`=?,`shirt16`=?,`shirt17`=?,`shirt18`=?,`cup_size`=?,`cup_style`=?,`shirt_style`=?,`shirt_size`=?,`patti`=?,`shirt_design`=?,`shirt_remark`=?,`pant1`=?,`pant2`=?,`pant3`=?,`pant4`=?,`pant5`=?,`pant6`=?,`pant7`=?,`pant8`=?,`pant9`=?,`pant10`=?,`pant11`=?,`pant12`=?,`pocket_size`=?,`back_pocket`=?,`watch_pocket`=?,`mobile_pocket`=?,`bottom_style`=?,`plate`=?,`pocket`=?,`iron`=?,`stiching`=?,`pant_remark`=?,`mobile_number`=?,`delivery_date`=?,`date`=?,`time`=? WHERE `id`= ?"))
			{ 
				$stmt_insert->bind_param("sssssssssssssssssssssssssssssssssssssssssssssssssssssi",$measurement_for,$customer_name,$shirt1,$shirt2,$shirt3,$shirt4,$shirt5,$shirt6,$shirt7,$shirt8,$shirt9,$shirt10,$shirt11,$shirt12,$shirt13,$shirt14,$shirt15,$shirt16,$shirt17,$shirt18,$cup_size,$cup_style,$shirt_style,$shirt_size,$patti,$shirt_design,$shirt_remark,$pant1,$pant2,$pant3,$pant4,$pant5,$pant6,$pant7,$pant8,$pant9,$pant10,$pant11,$pant12,$pocket_size,$back_pocket,$watch_pocket,$mobile_pocket,$bottom_style,$plate,$pocket,$iron,$stiching,$pant_remark,$mobile_number,$delivery_date,$date,$time,$res_edit_id);
				
				if($stmt_insert->execute())
				{
					return true;
				}
				return false;
			} 	
		}

		function change_delivery_status($delivery_id,$delivery_status)
		{ 
			$date = date("Y-m-d");
			$time = date("H-i-s A");
			
			if($stmt_insert = $this->con->prepare("UPDATE `shirt_measurement` SET `delivery_status`=? WHERE `id`= ?"))
			{ 
				$stmt_insert->bind_param("si",$delivery_status,$delivery_id);
				
				if($stmt_insert->execute())
				{
					return true;
				}
				return false;
			} 	
		}
		
		function update_customer_record($name,$address,$mobile_no,$opening_balance,$joining_date,$photo,$city,$res_edit_id)
		{ 
			$date = date("Y-m-d");
			$time = date("H-i-s A");
			
			if($stmt_insert = $this->con->prepare("UPDATE `customer` SET `name`=?,`address`=?,`mobile_no`=?,`opening_balance`=?,`joining_date`=?,`photo`=?,`city`=?,`date`=?,`time`=? WHERE`id`= ?"))
			{ 
				$stmt_insert->bind_param("sssssssssi",$name,$address,$mobile_no,$opening_balance,$joining_date,$photo,$city,$date,$time,$res_edit_id);
				
				if($stmt_insert->execute())
				{
					return true;
				}
				return false;
			} 	
		}
		
		function update_agent_record($emp_code,$full_name,$email_id,$mobile_no,$address,$password,$res_edit_id)
		{ 
			$date = date("Y-m-d");
			$time = date("H-i-s A");
			
			if($stmt_insert = $this->con->prepare("UPDATE `agent` SET `employee_code`=?,`full_name`=?,`email_id`=?,`mobile_no`=?,`address`=?,`password`=?,`date`=?,`time`=? WHERE `id`= ?"))
			{ 
				$stmt_insert->bind_param("ssssssi",$emp_code,$full_name,$email_id,$mobile_no,$address,$password,$date,$time,$res_edit_id);
				
				if($stmt_insert->execute())
				{
					return true;
				}
				return false;
			} 	
		}
		
		function update_worker_record($name,$address,$mobile_no,$opening_balance,$joining_date,$photo,$city,$res_edit_id)
		{ 
			$date = date("Y-m-d");
			$time = date("H-i-s A");
			
			if($stmt_insert = $this->con->prepare("UPDATE `worker` SET `name`=?,`address`=?,`mobile_no`=?,`opening_balance`=?,`joining_date`=?,`photo`=?,`city`=?,`date`=?,`time`=? WHERE`id`= ?"))
			{ 
				$stmt_insert->bind_param("sssssssssi",$name,$address,$mobile_no,$opening_balance,$joining_date,$photo,$city,$date,$time,$res_edit_id);
				
				if($stmt_insert->execute())
				{
					return true;
				}
				return false;
			} 	
		}
		
		function update_booking($booking_date,$select_project,$unit_no,$size_sq_ft,$rate_sq_ft,$total_amount,$discount,$rate_after_discount,$round_off,$net_amount,$load_from_leads_data,$mobile_no,$custamer_name,$email_id,$address,$pincode,$dob,$nominee,$age_of_nominee,$payment_type,$adhar_number,$PAN_card,$adhar_card_image,$PAN_card_image,$customer_photo_adhar_card,$cash_receipt_PAN_card_image,$customer_image,$cash_receipt,$sold_by,$commission,$plat_status,$remark,$res_edit_id)
		{ 
			$date = date("Y-m-d");
			$time = date("H-i-s A");
			
			if($stmt_insert = $this->con->prepare("UPDATE `bookings` SET `booking_date`=?,`select_project`=?,`unit_no`=?,`size_sq_ft`=?,`rate_sq_ft`=?,`total_amount`=?,`discount`=?,`rate_after_discount`=?,`round_off`=?,`net_amount`=?,`load_from_leads_data`=?,`mobile_no`=?,`custamer_name`=?,`email_id`=?,`address`=?,`pincode`=?,`dob`=?,`nominee`=?,`age_of_nominee`=?,`payment_type`=?,`adhar_number`=?,`PAN_card`=?,`adhar_card_image`=?,`PAN_card_image`=?,`customer_photo_adhar_card`=?,`cash_receipt_PAN_card_image`=?,`customer_image`=?,`cash_receipt`=?,`sold_by`=?,`commission`=?,`plat_status`=?,`remark`=?,`date`=?,`time`=? WHERE `id`= ?"))
			{ 
				$stmt_insert->bind_param("ssssssssssssssssssssssssssssssssssi",$booking_date,$select_project,$unit_no,$size_sq_ft,$rate_sq_ft,$total_amount,$discount,$rate_after_discount,$round_off,$net_amount,$load_from_leads_data,$mobile_no,$custamer_name,$email_id,$address,$pincode,$dob,$nominee,$age_of_nominee,$payment_type,$adhar_number,$PAN_card,$adhar_card_image,$PAN_card_image,$customer_photo_adhar_card,$cash_receipt_PAN_card_image,$customer_image,$cash_receipt,$sold_by,$commission,$plat_status,$remark,$date,$time,$res_edit_id);
				
				if($stmt_insert->execute())
				{
					return true;
				}
				return false;
			} 	
		}
		function update_payment_data($received_date,$receipt_no,$manual_receipt_no,$type_of_payment,$payment_mode,$amount,$remark,$res_edit_id)
		{ 
			$date = date("Y-m-d");
			$time = date("H-i-s A");
			
			if($stmt_insert = $this->con->prepare("UPDATE `payment` SET `received_date`=?,`receipt_no`=?,`manual_receipt_no`=?,`type_of_payment`=?,`payment_mode`=?,`amount`=?,`remark`=?,`date`=?,`time`=? WHERE `id`= ?"))
			{ 
				$stmt_insert->bind_param("sssssssssi",$received_date,$receipt_no,$manual_receipt_no,$type_of_payment,$payment_mode,$amount,$remark,$date,$time,$res_edit_id);
				
				if($stmt_insert->execute())
				{
					return true;
				}
				return false;
			} 	
		}
		
		function update_enquiry_data($project_id,$plot_no,$full_name,$dob,$mobile_no1,$mobile_no2,$email,$address,$occupation,$resource,$property_space,$property_type,$description,$status,$res_edit_id)
		{ 
			$date = date("Y-m-d");
			$time = date("H-i-s A");
			
			if($stmt_insert = $this->con->prepare("UPDATE `enquiry_form` SET `project_id`=?,`plot_no`=?,`full_name`=?,`dob`=?,`mobile_no1`=?,`mobile_no2`=?,`email`=?,`address`=?,`occupation`=?,`resource`=?,`property_space`=?,`property_type`=?,`description`=?,`status`=?,`date`=?,`time`=? WHERE `id` = ?"))
			{ 
				$stmt_insert->bind_param("ssssssssssssssssi",$project_id,$plot_no,$full_name,$dob,$mobile_no1,$mobile_no2,$email,$address,$occupation,$resource,$property_space,$property_type,$description,$status,$date,$time,$res_edit_id);
				
				if($stmt_insert->execute())
				{
					return true;
				}
				return false;
			} 	
		}
		
		function update_work_data($workers,$delivery_date,$remark,$res_edit_id)
		{ 
			$date = date("Y-m-d");
			$time = date("H-i-s A");
			
			if($stmt_insert = $this->con->prepare("UPDATE `assigned_work` SET `workers`=?,`delivery_date`=?,`remark`=?,`date`=?,`time`=? WHERE `id` = ?"))
			{ 
				$stmt_insert->bind_param("sssssi",$workers,$delivery_date,$remark,$date,$time,$res_edit_id);
				
				if($stmt_insert->execute())
				{
					return true;
				}
				return false;
			} 	
		}
		
		function update_worker_payment($workers,$amount,$payment_method,$remark,$res_edit_id)
		{ 
			$date = date("Y-m-d");
			$time = date("H-i-s A");
			
			if($stmt_insert = $this->con->prepare("UPDATE `worker-payment` SET `name`=?,`amount`=?,`payment_method`=?,`remark`=?,`date`=?,`time`=? WHERE `id` = ?"))
			{ 
				$stmt_insert->bind_param("ssssssi",$workers,$amount,$payment_method,$remark,$date,$time,$res_edit_id);
				
				if($stmt_insert->execute())
				{
					return true;
				}
				return false;
			} 	
		}
		

		
function get_measurement_data_from_id($res_edit_id)
		{ 
        if($stmt = $this->con->prepare("SELECT `id`, `customer_name`, `address`, `shirt1`, `shirt2`, `shirt3`, `shirt4`, `shirt5`, `shirt6`, `shirt7`, `shirt8`, `shirt9`, `shirt10`, `shirt11`, `shirt12`, `shirt13`, `shirt14`, `shirt15`, `shirt16`, `shirt17`, `shirt18`, `cup_size`, `cup_style`, `shirt_style`, `shirt_size`, `patti`, `shirt_design`,`collar`, `shirt_remark`, `pant1`, `pant2`, `pant3`, `pant4`, `pant5`, `pant6`, `pant7`, `pant8`, `pant9`, `pant10`, `pant11`, `pant12`, `pocket_size`, `back_pocket`, `watch_pocket`, `mobile_pocket`, `bottom_style`, `plate`, `pocket`, `iron`, `stitching`, `pant_remark`, `mobile_number`, `delivery_date`,`total_amount`, `discount`, `payable_amount`, `paid_amount`, `balance_amount`, `delivery_status`, `payment_method`,`date`, `time` FROM `shirt_measurement` WHERE `id`=?"))
		{
            $stmt->bind_param("i",$res_edit_id);
            $stmt->bind_result($res_id,$customer_name,$address,$shirt1,$shirt2,$shirt3,$shirt4,$shirt5,$shirt6,$shirt7,$shirt8,$shirt9,$shirt10,$shirt11,$shirt12,$shirt13,$shirt14,$shirt15,$shirt16,$shirt17,$shirt18,$cup_size,$cup_style,$shirt_style,$shirt_size,$patti,$shirt_design,$collar,$shirt_remark,$pant1,$pant2,$pant3,$pant4,$pant5,$pant6,$pant7,$pant8,$pant9,$pant10,$pant11,$pant12,$pocket_size,$back_pocket,$watch_pocket,$mobile_pocket,$bottom_style,$plate,$pocket,$iron,$stitching,$pant_remark,$mobile_number,$delivery_date,$total_amount,$discount,$payable_amount,$paid_amount,$balance_amount,$delivery_status,$payment_method,$date,$time);
				
			if($stmt->execute())
			{
				$users_data = array();
				$counter = 0;
			}
			while($stmt->fetch())
			{ 
            $users_data['id'] 					= $res_id;
			// $users_data['measurement_for'] 		= $measurement_for;
			$users_data['customer_name'] 			= $customer_name;
			$users_data['address'] 					= $address;
			$users_data['shirt1'] 				= $shirt1;
			$users_data['shirt2']				    = $shirt2;
			$users_data['shirt3'] 				= $shirt3;
			$users_data['shirt4'] 				= $shirt4;
			$users_data['shirt5'] 				= $shirt5;
			$users_data['shirt6'] 				= $shirt6;
			$users_data['shirt7'] 				= $shirt7;
			$users_data['shirt8'] 				= $shirt8;
			$users_data['shirt9']		    		= $shirt9;
			$users_data['shirt10'] 				= $shirt10;
			$users_data['shirt11'] 				= $shirt11;
			$users_data['shirt12'] 				= $shirt12;
			$users_data['shirt13'] 				= $shirt13;
			$users_data['shirt14'] 				= $shirt14;
			$users_data['shirt15'] 				= $shirt15;
			$users_data['shirt16'] 				= $shirt16;
			$users_data['shirt17'] 				= $shirt17;
			$users_data['shirt18']			    = $shirt18;
			$users_data['cup_size'] 				= $cup_size;
			$users_data['cup_style'] 				= $cup_style;
			$users_data['shirt_style'] 			= $shirt_style;
			$users_data['shirt_size'] 			= $shirt_size;
			$users_data['patti'] 					= $patti;
			$users_data['shirt_design'] 			= $shirt_design;
			$users_data['collar'] 			= $collar;
			$users_data['shirt_remark'] 			= $shirt_remark;
			$users_data['pant1'] 					= $pant1;
			$users_data['pant2'] 					= $pant2;
			$users_data['pant3'] 					= $pant3;
			$users_data['pant4'] 					= $pant4;
			$users_data['pant5'] 					= $pant5;
			$users_data['pant6'] 					= $pant6;
			$users_data['pant7'] 					= $pant7;
			$users_data['pant8'] 					= $pant8;
			$users_data['pant9'] 					= $pant9;
			$users_data['pant10'] 				= $pant10;
			$users_data['pant11'] 				= $pant11;
			$users_data['pant12'] 				= $pant12;
			$users_data['pocket_size'] 			= $pocket_size;
			$users_data['back_pocket'] 			= $back_pocket;
			$users_data['watch_pocket'] 			= $watch_pocket;
			$users_data['mobile_pocket'] 			= $mobile_pocket;
			$users_data['bottom_style'] 			= $bottom_style;
			$users_data['plate'] 					= $plate;
			$users_data['pocket'] 				= $pocket;
			$users_data['iron'] 					= $iron;
			$users_data['stitching'] 				= $stitching;
			$users_data['pant_remark'] 			= $pant_remark;
			$users_data['mobile_number'] 			= $mobile_number;
			$users_data['delivery_date'] 			= $delivery_date;
			$users_data['total_amount']		= $total_amount; 
			$users_data['discount']		= $discount; 
			$users_data['payable_amount']		= $payable_amount; 
			$users_data['paid_amount']		= $paid_amount; 
			$users_data['balance_amount']		= $balance_amount; 
			$users_data['delivery_status']		= $delivery_status; 
			$users_data['payment_method']		= $payment_method; 
			$users_data['date']					= $date;
			$users_data['time'] 					= $time;
            }
                if(!empty($users_data))
				{
                    return $users_data;
                }
                else
				{
                    return false;
                }
        }
    }

	function get_user_payment_entry_data_from_id($receipt_id)
	{ 

	if($stmt = $this->con->prepare("SELECT `id`, `receipt_id`, `shirt_price`, `pant_price`, `total_amount`, `discount_amount`, `payable_amount`, `paid_amount`, `balance_amount`, `payment_type`, `payment_remark`, `date`, `time` FROM `user_payment` Where `receipt_id`='".$receipt_id."'"))
	{
		$stmt->bind_result($res_id,$receipt_id,$shirt_price,$pant_price,$total_amount,$discount_amount,$payable_amount,$paid_amount,$balance_amount,$payment_type,$payment_remark,$date,$time);
			
		if($stmt->execute())
		{
			$users_data = array();

			$counter = 0;
		
			while($stmt->fetch())
			{ 
				$users_data[$counter][0] 		= $res_id;
				$users_data[$counter][1] 		= $receipt_id;
				$users_data[$counter][2] 		= $shirt_price;
				$users_data[$counter][3] 		= $pant_price;
				$users_data[$counter][4]		= $total_amount;
				$users_data[$counter][5] 		= $discount_amount;
				$users_data[$counter][6] 		= $payable_amount;
				$users_data[$counter][7] 		= $paid_amount;
				$users_data[$counter][8] 		= $balance_amount;
				$users_data[$counter][9] 		= $payment_type;
				$users_data[$counter][10] 		= $payment_remark;
				$users_data[$counter][11]		= $date;
				$users_data[$counter][12] 		= $time;

				$counter++;
			}

			if(!empty($users_data))
			{
				return $users_data;
			}
			else
			{
				return false;
			}
		}
	}
}


	function get_customer_data_from_id($res_edit_id)
		{ 
        if($stmt = $this->con->prepare("SELECT `id`, `name`, `address`, `mobile_no`, `opening_balance`, `joining_date`, `photo`, `city`, `date`, `time` FROM `customer` WHERE `id`=?"))
		{
            $stmt->bind_param("i",$res_edit_id);
            $stmt->bind_result($res_id,$name,$address,$mobile_no,$opening_balance,$joining_date,$photo,$city,$date,$time);
				
			if($stmt->execute())
			{
				$users_data = array();
				$counter = 0;
			}
			while($stmt->fetch())
			{ 
            $users_data['id'] 					= $res_id;
			$users_data['name'] 				= $name;
			$users_data['address'] 				= $address;
			$users_data['mobile_no'] 			= $mobile_no;
			$users_data['opening_balance']		= $opening_balance;
			$users_data['joining_date'] 		= $joining_date;
			$users_data['photo'] 				= $photo;
			$users_data['city'] 				= $city;
			$users_data['date']					= $date;
			$users_data['time'] 				= $time;
            }
                if(!empty($users_data))
				{
                    return $users_data;
                }
                else
				{
                    return false;
                }
        }
    }
	
	function get_agent_data_from_id($res_edit_id)
		{ 
        if($stmt = $this->con->prepare("SELECT `id`, `employee_code`, `full_name`, `email_id`, `mobile_no`, `address`, `password`, `date`, `time` FROM `agent` WHERE `id`=?"))
		{
            $stmt->bind_param("i",$res_edit_id);
            $stmt->bind_result($res_id,$emp_code,$full_name,$email_id,$mobile_no,$address,$password,$date,$time);
				
			if($stmt->execute())
			{
				$users_data = array();
				$counter = 0;
			}
			while($stmt->fetch())
			{ 
            $users_data['id'] 					= $res_id;
			$users_data['emp_code'] 			= $emp_code;
			$users_data['full_name'] 			= $full_name;
			$users_data['email_id'] 			= $email_id;
			$users_data['mobile_no']			= $mobile_no;
			$users_data['address'] 				= $address;
			$users_data['password'] 			= $password;
			$users_data['date']					= $date;
			$users_data['time'] 				= $time;
            }
                if(!empty($users_data))
				{
                    return $users_data;
                }
                else
				{
                    return false;
                }
        }
    }
	
	function get_worker_data_from_id($res_edit_id)
		{ 
        if($stmt = $this->con->prepare("SELECT `id`, `name`, `address`, `mobile_no`, `opening_balance`, `joining_date`, `photo`, `city`, `date`, `time` FROM `worker` WHERE `id`=?"))
		{
            $stmt->bind_param("i",$res_edit_id);
            $stmt->bind_result($res_id,$name,$address,$mobile_no,$opening_balance,$joining_date,$photo,$city,$date,$time);
				
			if($stmt->execute())
			{
				$users_data = array();
				$counter = 0;
			}
			while($stmt->fetch())
			{ 
            $users_data['id'] 					= $res_id;
			$users_data['name'] 				= $name;
			$users_data['address'] 				= $address;
			$users_data['mobile_no'] 			= $mobile_no;
			$users_data['opening_balance']		= $opening_balance;
			$users_data['joining_date'] 		= $joining_date;
			$users_data['photo'] 				= $photo;
			$users_data['city'] 				= $city;
			$users_data['date']					= $date;
			$users_data['time'] 				= $time;
            }
                if(!empty($users_data))
				{
                    return $users_data;
                }
                else
				{
                    return false;
                }
        }
    }


	function get_booking_data_from_id($res_edit_id)
		{ 
        if($stmt = $this->con->prepare("SELECT `id`, `booking_date`, `select_project`, `unit_no`, `size_sq_ft`, `rate_sq_ft`, `total_amount`, `discount`, `rate_after_discount`, `round_off`, `net_amount`, `load_from_leads_data`, `mobile_no`, `custamer_name`, `email_id`, `address`, `pincode`, `dob`, `nominee`, `age_of_nominee`, `payment_type`, `adhar_number`, `PAN_card`, `adhar_card_image`, `PAN_card_image`, `customer_photo_adhar_card`, `cash_receipt_PAN_card_image`, `customer_image`, `cash_receipt`, `sold_by`, `commission`, `plat_status`, `remark`, `date`, `time` FROM `bookings` WHERE `id`=?"))
		{ 
            $stmt->bind_param("i",$res_edit_id);
            $stmt->bind_result($res_id,$booking_date,$select_project,$unit_no,$size_sq_ft,$rate_sq_ft,$total_amount,$discount,$rate_after_discount,$round_off,$net_amount,$load_from_leads_data,$mobile_no,$custamer_name,$email_id,$address,$pincode,$dob,$nominee,$age_of_nominee,$payment_type,$adhar_number,$PAN_card,$adhar_card_image,$PAN_card_image,$customer_photo_adhar_card,$cash_receipt_PAN_card_image,$customer_image,$cash_receipt,$sold_by,$commission,$plat_status,$remark,$date,$time);
				
			if($stmt->execute())
			{
				$users_data = array();
				$counter = 0;
			}
			while($stmt->fetch())
			{ 
           		$users_data['res_id']             		 =   $res_id;								
				$users_data['booking_date']             =    $booking_date;					
				$users_data['select_project']           =    $select_project;				
				$users_data['unit_no']                  =    $unit_no;						
				$users_data['size_sq_ft']               =    $size_sq_ft;						
				$users_data['rate_sq_ft']               =    $rate_sq_ft;					
				$users_data['total_amount']             =    $total_amount;				
				$users_data['discount']                 =    $discount;					
				$users_data['rate_after_discount']      =    $rate_after_discount;		
				$users_data['round_off']                =    $round_off;					
				$users_data['net_amount']               =    $net_amount;					
				$users_data['load_from_leads_data']     =    $load_from_leads_data;		
				$users_data['mobile_no']                =    $mobile_no;					
				$users_data['custamer_name']            =    $custamer_name;				
				$users_data['email_id']                 =    $email_id;					
				$users_data['address']                  =    $address;					
				$users_data['pincode']                  =    $pincode;					
				$users_data['dob']                      =    $dob;						
				$users_data['nominee']                  =    $nominee;					
				$users_data['age_of_nominee']           =    $age_of_nominee;				
				$users_data['payment_type']             =    $payment_type;				
				$users_data['adhar_number']             =    $adhar_number; 			 	
				$users_data['PAN_card']             	 =   $PAN_card;					
				$users_data['adhar_card_image']         =    $adhar_card_image;			
				$users_data['PAN_card_image']           =    $PAN_card_image;				
				$users_data['customer_photo_adhar_card']    =    $customer_photo_adhar_card;		
				$users_data['cash_receipt_PAN_card_image']  =    $cash_receipt_PAN_card_image;	
				$users_data['customer_image']               =    $customer_image;					
				$users_data['cash_receipt']                 =    $cash_receipt;					
				$users_data['sold_by']                      =    $sold_by;						
				$users_data['commission']                   =    $commission; 					  
				$users_data['plat_status']                  =    $plat_status; 					  
				$users_data['remark']                       =    $remark; 						  
				$users_data['date']                         =    $date;							
				$users_data['time']                         =    $time;		
			}
                if(!empty($users_data))
				{
                    return $users_data;
                }
                else
				{
                    return false;
                }
        }
    }

	function get_payment_data_from_id($res_edit_id)
		{ 
        if($stmt = $this->con->prepare("SELECT `id`, `received_date`, `receipt_no`, `manual_receipt_no`, `type_of_payment`, `payment_mode`, `amount`, `remark`, `date`, `time` FROM `payment` WHERE `id`=?"))
		{ 
            $stmt->bind_param("i",$res_edit_id);
            $stmt->bind_result($res_id,$received_date,$receipt_no,$manual_receipt_no,$type_of_payment,$payment_mode,$amount,$remark,$date,$time);
				
			if($stmt->execute())
			{ 
				$users_data = array();
				$counter = 0;
			} 
			while($stmt->fetch())
			{ 
           		$users_data['res_id']             	=   $res_id;								
				$users_data['received_date']        =   $received_date;					
				$users_data['receipt_no']           =   $receipt_no;				
				$users_data['manual_receipt_no']    =   $manual_receipt_no;						
				$users_data['type_of_payment']      =   $type_of_payment;						
				$users_data['payment_mode']         =   $payment_mode;					
				$users_data['amount']            	=   $amount;				
				$users_data['remark']               =   $remark;
				$users_data['date']                 =   $date;							
				$users_data['time']                 =   $time;		
			}
                if(!empty($users_data))
				{
                    return $users_data;
                }
                else
				{
                    return false;
                }
        }
    }
	
	function get_enquiry_data_from_id($res_edit_id)
		{ 
        if($stmt = $this->con->prepare("SELECT `id`, `project_id`,`plot_no`, `full_name`, `dob`, `mobile_no1`, `mobile_no2`, `email`, `address`, `occupation`, `resource`, `property_space`, `property_type`, `description`, `status`, `date`, `time` FROM `enquiry_form` WHERE `id`=?"))
		{ 
            $stmt->bind_param("i",$res_edit_id);
            $stmt->bind_result($res_id,$project_id,$plot_no,$full_name,$dob,$mobile_no1,$mobile_no2,$email,$address,$occupation,$resource,$property_space,$property_type,$description,$status,$date,$time);
				
			if($stmt->execute())
			{ 
				$users_data = array();
				$counter = 0;
			} 
			while($stmt->fetch())
			{ 
           		$users_data['res_id']             	=   $res_id;					
				$users_data['project_id']           =   $project_id;				
				$users_data['plot_no']          	=   $plot_no;				
				$users_data['full_name']    		=   $full_name;						
				$users_data['dob']     				=   $dob;						
				$users_data['mobile_no1']         	=   $mobile_no1;					
				$users_data['mobile_no2']          	=   $mobile_no2;				
				$users_data['email']               	=   $email;
				$users_data['address']              =   $address;							
				$users_data['occupation']           =   $occupation;		
				$users_data['resource']             =   $resource;		
				$users_data['property_space']       =   $property_space;		
				$users_data['property_type']        =   $property_type;		
				$users_data['description']          =   $description;		
				$users_data['status']               =   $status;		
				$users_data['date']                 =   $date;		
				$users_data['time']                 =   $time;		
			}
                if(!empty($users_data))
				{
                    return $users_data;
                }
                else
				{
                    return false;
                }
        }
    }
	
	function get_work_data_from_id($res_edit_id)
		{ 
        if($stmt = $this->con->prepare("SELECT `id`, `workers`, `delivery_date`, `remark`, `date`, `time` FROM `assigned_work` WHERE `id`=?"))
		{ 
            $stmt->bind_param("i",$res_edit_id);
            $stmt->bind_result($res_id,$workers,$delivery_date,$remark,$date,$time);
				
			if($stmt->execute())
			{ 
				$users_data = array();
				$counter = 0;
			} 
			while($stmt->fetch())
			{ 
           		$users_data['res_id']             	=   $res_id;					
				$users_data['workers']           =   $workers;				
				$users_data['delivery_date']    		=   $delivery_date;						
				$users_data['remark']     				=   $remark;						
				
				$users_data['date']                 =   $date;		
				$users_data['time']                 =   $time;		
			}
                if(!empty($users_data))
				{
                    return $users_data;
                }
                else
				{
                    return false;
                }
        }
    }

	function get_worker_payment_from_id($res_edit_id)
		{ 
        if($stmt = $this->con->prepare("SELECT `id`, `name`, `amount`, `payment_method`, `remark`, `date`, `time` FROM `worker-payment` WHERE `id`=?"))
		{ 
            $stmt->bind_param("i",$res_edit_id);
            $stmt->bind_result($res_id,$workers,$amount,$payment_method,$remark,$date,$time);
				
			if($stmt->execute())
			{ 
				$users_data = array();
				$counter = 0;
			} 
			while($stmt->fetch())
			{ 
           		$users_data['res_id']             	=   $res_id;					
				$users_data['workers']           =   $workers;				
				$users_data['amount']    		=   $amount;						
				$users_data['payment_method']    		=   $payment_method;						
				$users_data['remark']     				=   $remark;						
				$users_data['date']                 =   $date;		
				$users_data['time']                 =   $time;		
			}
                if(!empty($users_data))
				{
                    return $users_data;
                }
                else
				{
                    return false;
                }
        }
    }


    function insert_master_categor_title($master_category,$title)
		{ 
			$date = date("Y-m-d");
			$time = date("H-i-s A");
						
			if($stmt_insert = $this->con->prepare("INSERT INTO `tailor_master`( `category`, `title`, `date`, `time`) VALUES (?,?,?,?)"))
			{ 
				$stmt_insert->bind_param("ssss",$master_category,$title,$date,$time);
				
				if($stmt_insert->execute())
				{ 
					return true;
				} 
				return false;
			} 	
		}
		

		function get_project_count_from_projects()
		{
			if($stmt_select = $this->con->prepare("SELECT COUNT(`id`) FROM `shirt_measurement` where `delivery_status`='Pending'"));
			{
				$stmt_select->bind_result($result_count);
			
				if($stmt_select->execute())
				{
					if($stmt_select->fetch())
					{
						return $result_count;
					}
				}
				return false;
			}
		}
        
		function get_booking_count_from_bookings()
		{
			if($stmt_select = $this->con->prepare("SELECT COUNT(`id`) FROM `shirt_measurement` where `delivery_status` = 'Completed'"));
			{
				
				$stmt_select->bind_result($result_count);
			
				if($stmt_select->execute())
				{
					if($stmt_select->fetch())
					{
						return $result_count;
					}
				}
				return false;
			}
		}

		function get_agent_password($var_mobile_no)
	{
		if($stmt=$this->con->prepare("SELECT `password` from `agent` WHERE `mobile_no` =?  "))
        {
            $stmt->bind_param("s",$var_mobile_no);
            $stmt->bind_result($var_password);
            if($stmt->execute())
            {
                if($stmt->fetch())
                {
                    return $var_password;
                }
                else
                {
                    return false;
                }
            }
        }
	}
	

	function get_project_details_from_id($res_edit_id)
    {
        if($stmt = $this->con->prepare("SELECT `id`, `project_name`, `project_address`, `registration_no`, `location`, `project_type`, `project_current_status`, `project_layout`, `project_logo`, `image1`, `image2`, `image3`, `image4`, `image5`, `image6`, `image7`, `image8`, `image9`, `image10`, `video`, `no_of_towers`, `project_selling_status`, `latitude`, `longitude`, `added`, `project_facilities`, `description`, `date`, `time` FROM `projects` WHERE `id`=?"))
			{	
		        $stmt->bind_param("i",$res_edit_id);
				$stmt->bind_result($res_id,$project_name,$project_address,$registration_no,$location,$project_type,$project_current_status,$project_layout,$project_logo,$image1,$image2,$image3,$image4,$image5,$image6,$image7,$image8,$image9,$image10,$video,$no_of_towers,$project_selling_status,$latitude,$longitude,$added,$project_facilities,$description,$date,$time);
				
			if($stmt->execute())
            {
                $details=array();
                if($stmt->fetch())
                {
	
                    
						$details['id']	=	$res_id;
						$details['project_name']	=	$project_name;
						$details['project_address']	=	$project_address;
						$details['registration_no']	=	$registration_no;
						$details['location']	=	$location;
						$details['project_type']	=	$project_type;
						$details['project_current_status']	=	$project_current_status;
						$details['project_layout']	=	$project_layout;
						$details['project_logo']	=	$project_logo;
						$details['image1']	=	$image1;
						$details['image2']	=	$image2;
						$details['image3']	=	$image3;
						$details['image4']	=	$image4;						
						$details['image5']	=	$image5;
						$details['image6']	=	$image6;
						$details['image7']	=	$image7;
						$details['image8']	=	$image8;
						$details['image9']	=	$image9;
						$details['image10']	=	$image10;
						$details['video']	=	$video;
						$details['no_of_towers']	=	$no_of_towers;
						$details['project_selling_status']	=	$project_selling_status;
						$details['latitude']	=	$latitude;						
						$details['longitude']	=	$longitude;
						$details['added']	=	$added;
						$details['project_facilities']	=	$project_facilities;
						$details['description']	=	$description;
						$details['date']	=	$date;
						$details['time']	=	$time;
					
						
					}
					if(!empty($details))	
					{
						return $details;
					}
					return false;
				}	
			}
		}


		function get_all_plot_project_from_projectid($res_edit_id)
		{
			if($stmt_insert = $this->con->prepare("SELECT `id`, `project_id`, `plot_owener`, `enter_floor_no`, `unit_no`, `unit_label`, `sq_mtr`, `sq_ft`, `lambi`, `rundi`, `plot_status`, `unit_type`, `select_bhk`, `carpet_area`, `bulit_up_area`, `saleable_area`, `facing`, `approximate_rate_per_sq_ft`, `latitude`, `longitude`, `phase`, `image1`, `image2`, `image3`, `image4`, `image5`, `date`, `time` FROM `plot_project`"))
			{	
				$stmt_insert->bind_result($id,$project_id,$plot_owener,$enter_floor_no,$unit_no,$unit_label,$sq_mtr,$sq_ft,$lambi,$rundi,$carpet_area,$bulit_up_area,$saleable_area,$facing,$approximate_rate_per_sq_ft,$latitude,$longitude,$phase,$plot_status,$unit_type,$select_bhk,$image1,$image2,$image3,$image4,$image5,$date,$time);
				
				if($stmt_insert->execute())
				{
					$counter	=	0;
					$details	=	array();
					while($stmt_insert->fetch())
					{
						$details[$counter][0]	=	$id;
						$details[$counter][1]	=	$project_id;
						$details[$counter][2]	=	$plot_owener;
						$details[$counter][3]	=	$enter_floor_no;
						$details[$counter][4]	=	$unit_no;
						$details[$counter][5]	=	$unit_label;
						$details[$counter][6]	=	$sq_mtr;
						$details[$counter][7]	=	$sq_ft;
						$details[$counter][8]	=	$lambi;
						$details[$counter][9]	=	$rundi;
						$details[$counter][10]	=	$plot_status;
						$details[$counter][11]	=	$unit_type;
						$details[$counter][12]	=	$select_bhk;
						$details[$counter][13]	=	$carpet_area;
						$details[$counter][14]	=	$bulit_up_area;
						$details[$counter][15]	=	$saleable_area;
						$details[$counter][16]	=	$facing;
						$details[$counter][17]	=	$approximate_rate_per_sq_ft;
						$details[$counter][18]	=	$latitude;
						$details[$counter][19]	=	$longitude;
						$details[$counter][20]	=	$phase;
						$details[$counter][21]	=	$image1;
						$details[$counter][22]	=	$image2;
						$details[$counter][23]	=	$image3;
						$details[$counter][24]	=	$image4;
						$details[$counter][25]	=	$image5;
						$details[$counter][26]	=	$date;
						$details[$counter][27]	=	$time;
					
						$counter++;
					}
					if(!empty($details))	
					{
						return $details;
					}
					return false;
				}	
			}
		}
		function add_patient_registration($patient_id,$full_name,$photo,$gender,$dob,$age,$city,$pincode,$address_1,$address_2,
			$email,$mobile_1,$mobile_2,$remark,$others_1,$others_2,$others_3,$others_4,$others_5)
		{
			$date = date("Y-m-d");
			$time = date("H-i-s A");
			
			if($stmt_insert = $this->con->prepare("INSERT INTO `patient`(`patient_id`, `name`, `photo`, `gender`, `dob`, `age`, `city`, `pincode`, `address_1`, `address_2`, `email`, `mobile_1`, `mobile_2`, `remark`, `others_1`, `others_2`, `others_3`, `others_4`, `others_5`, `date`, `time`) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"))
			{
				$stmt_insert->bind_param("sssssssssssssssssssss",$patient_id,$full_name,$photo,$gender,$dob,$age,$city,$pincode,$address_1,$address_2,
			$email,$mobile_1,$mobile_2,$remark,$others_1,$others_2,$others_3,$others_4,$others_5,$date,$time);
				
				if($stmt_insert->execute())
				{
					return true;
				}
					return false;
			} 	
		}
		
		
		function get_all_patient_registration()
		{
			if($stmt_insert = $this->con->prepare("SELECT `id`, `patient_id`, `name`, `photo`, `gender`, `dob`, `age`, `city`, `pincode`, `address_1`, `address_2`, `email`, `mobile_1`, `mobile_2`, `remark`, `others_1`, `others_2`, `others_3`, `others_4`, `others_5`, `date`, `time` FROM `patient`"))
			{	
				$stmt_insert->bind_result($id,$patient_id,$full_name,$photo,$gender,$dob,$age,$city,$pincode,$address_1,$address_2,
			$email,$mobile_1,$mobile_2,$remark,$others_1,$others_2,$others_3,$others_4,$others_5,$date,$time);
				
				if($stmt_insert->execute())
				{
					$counter	=	0;
					$details	=	array();
					while($stmt_insert->fetch())
					{
						$details[$counter][0]	=	$id;
						$details[$counter][1]	=	$patient_id;
						$details[$counter][2]	=	$full_name;
						$details[$counter][3]	=	$photo;
						$details[$counter][4]	=	$gender;
						$details[$counter][5]	=	$dob;
						$details[$counter][6]	=	$age;
						$details[$counter][7]	=	$city;
						$details[$counter][8]	=	$pincode;
						$details[$counter][9]	=	$address_1;
						$details[$counter][10]	=	$address_2;
						$details[$counter][11]	=	$email;
						$details[$counter][12]	=	$mobile_1;
						$details[$counter][13]	=	$mobile_2;
						$details[$counter][14]	=	$remark;							
						$details[$counter][15]	=	$date;
						$details[$counter][16]	=	$time;
					
						$counter++;
					}
					if(!empty($details))	
					{
						return $details;
					}
					return false;
				}	
			}
		}
		function delete_patient_registration($delete_id)
		{
			if($stmt_select = $this->con->prepare("DELETE FROM `patient` WHERE `id`=?"))
			{
				$stmt_select->bind_param("i",$delete_id);
			
				if($stmt_select->execute())
				{					
						return true;
				}
					return false;
			}
		}
		function update_patient_registration($patient_id, $full_name, $gender, $dob, $age, $city, $pincode, $address_1, $address_2, $email, $mobile_1, $mobile_2, $remark, $res_edit_id)
		{
    $date = date("Y-m-d");
    $time = date("H-i-s A");

    if ($stmt_insert = $this->con->prepare("UPDATE `patient` SET `patient_id`=?, `name`=?, `gender`=?, `dob`=?, `age`=?, `city`=?, `pincode`=?, `address_1`=?, `address_2`=?, `email`=?, `mobile_1`=?, `mobile_2`=?, `remark`=?, `date`=?, `time`=? WHERE `id`=?")) {
        $stmt_insert->bind_param("sssssssssssssssi", $patient_id, $full_name, $gender, $dob, $age, $city, $pincode, $address_1, $address_2, $email, $mobile_1, $mobile_2, $remark, $date, $time, $res_edit_id);
        
        if ($stmt_insert->execute()) {
            return true;
        } else {
            return false;
        }
    } else {
        return false;
    }
}

		function get_patient_data_from_id($res_edit_id)
		{ 
        if($stmt = $this->con->prepare(" SELECT `id`, `patient_id`, `name`,`gender`, `dob`, `age`, `city`, `pincode`, `address_1`, `address_2`, `email`, `mobile_1`, `mobile_2`, `remark`, `date`, `time` FROM `patient` WHERE `id`=?"))
		{ 
            $stmt->bind_param("i",$res_edit_id);
            $stmt->bind_result($id,$patient_id,$full_name,$gender,$dob,$age,$city,$pincode,$address_1,$address_2,$email,$mobile_1,$mobile_2,$remark,$date,$time);
				
			if($stmt->execute())
			{ 
				$users_data = array();
				$counter = 0;
			} 
			while($stmt->fetch())
			{ 
           		$users_data['id']             	=   $id;								
				$users_data['patient_id']        =  $patient_id;					
				$users_data['name']                =   $full_name;	
	            $users_data['gender']                =   $gender;					
				$users_data['dob']               =   $dob;						
				$users_data['age']           	    =   $age;					
				$users_data['city']            	    =   $city;				
				$users_data['pincode']               =   $pincode;
				$users_data['address_1']            =   $address_1;							
				$users_data['address_2']            =   $address_2;	
                $users_data['email']                =   $email;				
				$users_data['mobile_1']             =   $mobile_1;						
				$users_data['mobile_2']             =   $mobile_2;						
				$users_data['remark']               =   $remark;					
				$users_data['date']                 =   $date;							
				$users_data['time']                 =   $time;						
			}
                if(!empty($users_data))
				{
                    return $users_data;
                }
                else
				{
                    return false;
                }
        }
    }
	function add_course_module($doctor_id,$course_name,$description,$keywords,$thumb_nail_image,$about_speaker,$others_1,$others_2,$others_3)
		{
			$date = date("Y-m-d");
			$time = date("H-i-s A");
			
			if($stmt_insert = $this->con->prepare("INSERT INTO `course_module`( `doctor_id`, `course_name`, `description`, `keywords`, `thumb_nail_image`, `about_speaker`, `others_1`, `others_2`, `others_3`, `date`, `time`) VALUES(?,?,?,?,?,?,?,?,?,?,?)"))
			{
				$stmt_insert->bind_param("sssssssssss",$doctor_id,$course_name,$description,$keywords,$thumb_nail_image,$about_speaker,$others_1,$others_2,$others_3,$date,$time);
				
				if($stmt_insert->execute())
				{
					return true;
				}
					return false;
			} 	
		}
		function get_all_course_module()
		{
			if($stmt_insert = $this->con->prepare("SELECT `id`, `doctor_id`, `course_name`, `description`, `keywords`, `thumb_nail_image`, `about_speaker`, `date`, `time` FROM `course_module`"))
			{	
				$stmt_insert->bind_result($id,$doctor_id,$course_name,$description,$keywords,$thumb_nail_image,$about_speaker,$date,$time);
				
				if($stmt_insert->execute())
				{
					$counter	=	0;
					$details	=	array();
					while($stmt_insert->fetch())
					{
						$details[$counter][0]	=	$id;
						$details[$counter][1]	=	$doctor_id;
						$details[$counter][2]	=	$course_name;
						$details[$counter][3]	=	$description;
						$details[$counter][4]	=	$keywords;
						$details[$counter][5]	=	$thumb_nail_image;
						$details[$counter][6]	=	$about_speaker;			
						$details[$counter][7]	=	$date;
						$details[$counter][8]	=	$time;
					
						$counter++;
					}
					if(!empty($details))	
					{
						return $details;
					}
					return false;
				}	
			}
		}
		

		function delete_course_module($delete_id)
		{
			if($stmt_select = $this->con->prepare("DELETE FROM `course_module` WHERE `id`=?"))
			{
				$stmt_select->bind_param("i",$delete_id);
			
				if($stmt_select->execute())
				{					
						return true;
				}
					return false;
			}
		}
		
		function update_course_module($doctor_id,$course_name,$description,$keywords,$about_speaker,$res_edit_id)
		{
    $date = date("Y-m-d");
    $time = date("H-i-s A");

    if ($stmt_insert = $this->con->prepare("UPDATE `course_module` SET `doctor_id`=?,`course_name`=?,`description`=?,`keywords`=?,`about_speaker`=?,`date`=?,`time`=? WHERE  `id`=?")) {
        $stmt_insert->bind_param("sssssssi",$doctor_id,$course_name,$description,$keywords,$about_speaker , $date, $time, $res_edit_id);
        
        if ($stmt_insert->execute()) {
            return true;
        } else {
            return false;
        }
    } else {
        return false;
    }
}

function get_course_module_data_from_id($res_edit_id)
{ 
        if($stmt = $this->con->prepare(" SELECT `id`, `doctor_id`, `course_name`, `description`, `keywords`,  `about_speaker`,  `date`, `time` FROM `course_module` WHERE `id`=?"))
		{ 
            $stmt->bind_param("i",$res_edit_id);
            $stmt->bind_result($id,$doctor_id,$course_name,$description,$keywords,$about_speaker,$date,$time);
				
			if($stmt->execute())
			{ 
				$users_data = array();
				$counter = 0;
			} 
			while($stmt->fetch())
			{ 
           		$users_data['id']             			 =   $id;								
				$users_data['doctor_id']      			 =   $doctor_id;					
				$users_data['course_name']               =   $course_name;	
	            $users_data['description']               =   $description;					
				$users_data['keywords']              	 =   $keywords;						
				$users_data['about_speaker']           	 =   $about_speaker;																	
				$users_data['date']                		 =   $date;							
				$users_data['time']               		 =   $time;						
			}
                if(!empty($users_data))
				{
                    return $users_data;
                }
                else
				{
                    return false;
                }
        }
    }

function add_session_module($doctor_id, $session_name, $description, $keywords, $cover_photo, $about_speaker)
		{
			$date = date("Y-m-d");
			$time = date("H-i-s A");
			
			if($stmt_insert = $this->con->prepare("INSERT INTO `session_module`( `doctor_id`, `session_name`, `description`, `keywords`, `thumb_nail_image`, `about_speaker`, `date`, `time`) VALUES(?,?,?,?,?,?,?,?)"))
			{
				$stmt_insert->bind_param("ssssssss",$doctor_id, $session_name, $description, $keywords, $cover_photo, $about_speaker,$date,$time);
				
				if($stmt_insert->execute())
				{
					return true;
				}
					return false;
			} 	
		}
		
		function get_all_session_module()
		{
			if($stmt_insert = $this->con->prepare("SELECT `id`, `doctor_id`, `session_name`, `description`, `keywords`, `thumb_nail_image`, `about_speaker`, `date`, `time` FROM `session_module`"))
			{	
				$stmt_insert->bind_result($id,$doctor_id,$session_name,$description,$keywords,$cover_photo,$about_speaker,$date,$time);
				
				if($stmt_insert->execute())
				{
					$counter	=	0;
					$details	=	array();
					while($stmt_insert->fetch())
					{
						$details[$counter][0]	=	$id;
						$details[$counter][1]	=	$doctor_id;
						$details[$counter][2]	=	$session_name;
						$details[$counter][3]	=	$description;
						$details[$counter][4]	=	$keywords;
						$details[$counter][5]	=	$cover_photo;
						$details[$counter][6]	=	$about_speaker;			
						$details[$counter][7]	=	$date;
						$details[$counter][8]	=	$time;
					
						$counter++;
					}
					if(!empty($details))	
					{
						return $details;
					}
					return false;
				}	
			}
		}
		

		function delete_session_module($delete_id)
		{
			if($stmt_select = $this->con->prepare("DELETE FROM `session_module` WHERE `id`=?"))
			{
				$stmt_select->bind_param("i",$delete_id);
			
				if($stmt_select->execute())
				{					
						return true;
				}
					return false;
			}
		}

	function update_session_module($doctor_id,$session_name,$description,$keywords,$about_speaker,$res_edit_id)
		{
    $date = date("Y-m-d");
    $time = date("H-i-s A");

    if ($stmt_insert = $this->con->prepare("UPDATE `session_module` SET `doctor_id`=?,`session_name`=?,`description`=?,`keywords`=?,`about_speaker`=?,`date`=?,`time`=? WHERE  `id`=?")) {
        $stmt_insert->bind_param("sssssssi",$doctor_id,$session_name,$description,$keywords,$about_speaker , $date, $time, $res_edit_id);
        
        if ($stmt_insert->execute()) {
            return true;
        } else {
            return false;
        }
    } else {
        return false;
    }
}

function get_session_module_data_from_id($res_edit_id)
{ 
        if($stmt = $this->con->prepare(" SELECT `id`, `doctor_id`, `session_name`, `description`, `keywords`,  `about_speaker`,  `date`, `time` FROM `session_module` WHERE `id`=?"))
		{ 
            $stmt->bind_param("i",$res_edit_id);
            $stmt->bind_result($id,$doctor_id,$session_name,$description,$keywords,$about_speaker,$date,$time);
				
			if($stmt->execute())
			{ 
				$users_data = array();
				$counter = 0;
			} 
			while($stmt->fetch())
			{ 
           		$users_data['id']             			 =   $id;								
				$users_data['doctor_id']      			 =   $doctor_id;					
				$users_data['session_name']               =   $session_name;	
	            $users_data['description']               =   $description;					
				$users_data['keywords']              	 =   $keywords;						
				$users_data['about_speaker']           	 =   $about_speaker;																	
				$users_data['date']                		 =   $date;							
				$users_data['time']               		 =   $time;						
			}
                if(!empty($users_data))
				{
                    return $users_data;
                }
                else
				{
                    return false;
                }
        }
    }
	
	/*<!--------------------------------------------------Start reminder--------------------------------------------------->*/
	
	function add_reminders($title,$description,$deadline_date,$organize_date,$added_by,$completed_by,$status)
		{
			$date = date("Y-m-d");
			$time = date("H-i-s A");
			
			if($stmt_insert = $this->con->prepare("INSERT INTO `reminders`(`title`, `description`, `deadline_date`, `organize_date`, `added_by`, `completed_by`, `status`, `date`, `time`) VALUES (?,?,?,?,?,?,?,?,?)"))
			{
				$stmt_insert->bind_param("sssssssss",$title,$description,$deadline_date,$organize_date,$added_by,$completed_by,$status,$date,$time);
				
				if($stmt_insert->execute())
				{
					return true;
				}
					return false;
			} 	
		}
		
		function get_all_reminders()
		{
			if($stmt_insert = $this->con->prepare("SELECT `id`, `title`, `description`, `deadline_date`, `organize_date`, `added_by`, `completed_by`, `status`, `date`, `time` FROM `reminders`"))
			{	
				$stmt_insert->bind_result($res_id,$title,$description,$deadline_date,$organize_date,$added_by,$completed_by,$status,$date,$time);
				
				if($stmt_insert->execute())
				{
					$counter	=	0;
					$details	=	array();
					while($stmt_insert->fetch())
					{
						
						$details[$counter][0]	=	$res_id;
						$details[$counter][1]	=	$title;
						$details[$counter][2]	=	$description;
						$details[$counter][3]	=	$deadline_date;
						$details[$counter][4]	=	$organize_date;
						$details[$counter][5]	=	$added_by;	
						$details[$counter][6]	=	$completed_by;
						$details[$counter][7]	=	$status;
						$details[$counter][8]	=	$date;
						$details[$counter][9]	=	$time;					
					
						$counter++;
					}
					if(!empty($details))	
					{
						return $details;
					}
					return false;
				}	
			}
		}
		
		function delete_reminders($del_id)
		{
			if($stmt_select = $this->con->prepare("DELETE FROM `reminders` WHERE `id`=?"))
			{
				$stmt_select->bind_param("i",$del_id);
			
				if($stmt_select->execute())
				{					
						return true;
				}
					return false;
			}
		}
		
		function update_reminders_record($title,$description,$deadline_date,$organize_date,$added_by,$completed_by,$status,$res_edit_id)
		{ 
			$date = date("Y-m-d");
			$time = date("H-i-s A");
			
			if($stmt_insert = $this->con->prepare("UPDATE `reminders` SET `title`=?,`description`=?,`deadline_date`=?,`organize_date`=?,`added_by`=?,`completed_by`=?,`status`=?,`date`=?,`time`=? WHERE`id`= ?"))
			{ 
				$stmt_insert->bind_param("sssssssssi",$title,$description,$deadline_date,$organize_date,$added_by,$completed_by,$status,$date,$time,$res_edit_id);
				
				if($stmt_insert->execute())
				{
					return true;
				}
				return false;
			} 	
		}
		
		function get_reminders_data_from_id($res_edit_id)
		{ 
        if($stmt = $this->con->prepare("SELECT `id`, `title`, `description`, `deadline_date`, `organize_date`, `added_by`, `completed_by`, `status`, `date`, `time` FROM `reminders` WHERE `id`=?"))
		{
            $stmt->bind_param("i",$res_edit_id);
            $stmt->bind_result($res_id,$title,$description,$deadline_date,$organize_date,$added_by,$completed_by,$status,$date,$time);
				
			if($stmt->execute())
			{
				$users_data = array();
				$counter = 0;
			}
			while($stmt->fetch())
			{ 
            $users_data['id'] 					= $res_id;
			$users_data['title'] 				= $title;
			$users_data['description'] 			= $description;
			$users_data['deadline_date'] 		= $deadline_date;
			$users_data['organize_date']		= $organize_date;
			$users_data['added_by'] 			= $added_by;
			$users_data['completed_by'] 		= $completed_by;
			$users_data['status'] 				= $status;
			$users_data['date']					= $date;
			$users_data['time'] 				= $time;
            }
                if(!empty($users_data))
				{
                    return $users_data;
                }
                else
				{
                    return false;
        }
    }
	
	/*<!---------------------------------------------end code reminders------------------------------------------------------->*/
	
	
	
function insert_new_doctor($doctor_name,$photo,$gender,$dob,$age,$city,$pincode,$address_1,$address_2,$email,$mobile_1,$mobile_2,$professional_statement,$practicing_from,$qualification_name,$specialization_in,$is_available,$other_1,$other_2,$other_3,$other_4,$other_5)
		{
			$date = date("Y-m-d");
			$time = date("H-i-s A");
			
			if($stmt_insert = $this->con->prepare("INSERT INTO `doctor_registration`(`doctor_name`, `photo`, `gender`, `dob`, `age`, `city`, `pincode`, `address_1`, `address_2`, `email`, `mobile_1`, `mobile_2`, `professional_statement`, `practicing_from`, `qualification_name`, `specialization_in`, `is_available`, `other_1`, `other_2`, `other_3`, `other_4`, `other_5`, `date`, `time`) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"))
			{
				$stmt_insert->bind_param("ssssssssssssssssssssssss",$doctor_name,$photo,$gender,$dob,$age,$city,$pincode,$address_1,$address_2,$email,$mobile_1,$mobile_2,$professional_statement,$practicing_from,$qualification_name,$specialization_in,$is_available,$other_1,$other_2,$other_3,$other_4,$other_5,$date,$time);

				if($stmt_insert->execute())
				{
					return true;
				}
				return false;
			} 	
		}
		}
function get_all_doctor_data($doctor_name,$mobile_1)
		{

			
			$wcustomer_name_statement = "";

			if($doctor_name!="")
			{
				$wcustomer_name_statement = " WHERE `doctor_name` LIKE '%".$doctor_name."%'";
			}

			$wstatement_mobile_number = "";
			if($mobile_1!="")
			{
			
				$wstatement_mobile_number = " WHERE `mobile_1` LIKE '%".$mobile_1."%'";
			}
			

			if($stmt_insert = $this->con->prepare("SELECT `id`, `doctor_id`, `doctor_name`, `photo`, `gender`, `dob`, `age`, `city`, `pincode`, `address_1`, `address_2`, `email`, `mobile_1`, `mobile_2`, `professional_statement`, `practicing_from`, `qualification_name`, `specialization_in`, `is_available`, `other_1`, `other_2`, `other_3`, `other_4`, `other_5`, `date`, `time` FROM `doctor_registration`  ".$wcustomer_name_statement.$wstatement_mobile_number))
			{	
				// $stmt_insert->bind_param("ss",$from_date,$to_date);

				$stmt_insert->bind_result($id,$doctor_id,$doctor_name,$photo,$gender,$dob,$age,$city,$pincode,$address_1,$address_2,$email,$mobile_1,$mobile_2,$professional_statement,$practicing_from,$qualification_name,$specialization_in,$is_available,$other_1,$other_2,$other_3,$other_4,$other_5,$date,$time);
				
				if($stmt_insert->execute())
				{
					$counter	=	0;
					$details	=	array();
					while($stmt_insert->fetch())
					{
						$details[$counter][0]	=	$id;
						$details[$counter][1]	=	$doctor_id;
						$details[$counter][2]	=	$doctor_name;
						$details[$counter][3]	=	$photo;
						$details[$counter][4]	=	$gender;
						$details[$counter][5]	=	$dob;
						$details[$counter][6]	=	$age;
						$details[$counter][7]	=	$city;
						$details[$counter][8]	=	$pincode;
						$details[$counter][9]	=	$address_1;
						$details[$counter][10]	=	$address_2;
						$details[$counter][11]	=	$email;
						$details[$counter][12]	=	$mobile_1;
						$details[$counter][13]	=	$mobile_2;
						$details[$counter][14]	=	$professional_statement;
						$details[$counter][15]	=	$practicing_from;
						$details[$counter][16]	=	$qualification_name;
						$details[$counter][17]	=	$specialization_in;
						$details[$counter][18]	=	$is_available;
						$details[$counter][19]	=	$other_1;
						$details[$counter][20]	=	$other_2;
						$details[$counter][21]	=	$other_3;
						$details[$counter][22]	=	$other_4;
						$details[$counter][23]	=	$other_5;
						$details[$counter][24]	=	$date;
						$details[$counter][25]	=	$time;
					
						$counter++;
					}
					if(!empty($details))	
					{
						return $details;
					}
					return false;
				}	
			}
		}
 function get_all_doctors_data()
 {
			if($stmt_insert = $this->con->prepare("SELECT `id`, `doctor_id`, `doctor_name`, `photo`, `gender`, `dob`, `age`, `city`, `pincode`, `address_1`, `address_2`, `email`, `mobile_1`, `mobile_2`, `professional_statement`, `practicing_from`, `qualification_name`, `specialization_in`, `is_available`, `other_1`, `other_2`, `other_3`, `other_4`, `other_5`, `date`, `time` FROM `doctor_registration`  "))
			{	
				$stmt_insert->bind_result($id,$doctor_id,$doctor_name,$photo,$gender,$dob,$age,$city,$pincode,$address_1,$address_2,$email,$mobile_1,$mobile_2,$professional_statement,$practicing_from,$qualification_name,$specialization_in,$is_available,$other_1,$other_2,$other_3,$other_4,$other_5,$date,$time);
				
				if($stmt_insert->execute())
				{
					$counter	=	0;
					$details	=	array();
					while($stmt_insert->fetch())
					{
						
						$details[$counter][0]	=	$id;
						$details[$counter][1]	=	$doctor_id;
						$details[$counter][2]	=	$doctor_name;
						$details[$counter][3]	=	$photo;
						$details[$counter][4]	=	$gender;
						$details[$counter][5]	=	$dob;
						$details[$counter][6]	=	$age;
						$details[$counter][7]	=	$city;
						$details[$counter][8]	=	$pincode;
						$details[$counter][9]	=	$address_1;
						$details[$counter][10]	=	$address_2;
						$details[$counter][11]	=	$email;
						$details[$counter][12]	=	$mobile_1;
						$details[$counter][13]	=	$mobile_2;
						$details[$counter][14]	=	$professional_statement;
						$details[$counter][15]	=	$practicing_from;
						$details[$counter][16]	=	$qualification_name;
						$details[$counter][17]	=	$specialization_in;
						$details[$counter][18]	=	$is_available;
						$details[$counter][19]	=	$other_1;
						$details[$counter][20]	=	$other_2;
						$details[$counter][21]	=	$other_3;
						$details[$counter][22]	=	$other_4;
						$details[$counter][23]	=	$other_5;
						$details[$counter][24]	=	$date;
						$details[$counter][25]	=	$time;
					
						$counter++;
					}
					if(!empty($details))	
					{
						return $details;
					}
					return false;
				}	
			}
		}
		/*<!---------------------------------------------Start code work------------------------------------------------------->*/
		
		
		function add_work_list($added_by,$work_update_title,$work_update_description,$status)
		{
			$date = date("Y-m-d");
			$time = date("H-i-s A");
			
			if($stmt_insert = $this->con->prepare("INSERT INTO `work_list`(`added_by`, `work_update_title`, `work_update_description`, `status`, `date`, `time`) VALUES (?,?,?,?,?,?)"))
			{
				$stmt_insert->bind_param("ssssss",$added_by,$work_update_title,$work_update_description,$status,$date,$time);
				
				if($stmt_insert->execute())
				{
					return true;
				}
					return false;
			} 	
		}
		
		
		function delete_work_list($del_id)
		{
			if($stmt_select = $this->con->prepare("DELETE FROM `work_list` WHERE `id`=?"))
			{
				$stmt_select->bind_param("i",$del_id);
			
				if($stmt_select->execute())
				{					
						return true;
				}
					return false;
			}
		}
		
		
		function get_all_work_list()
		{
			if($stmt_insert = $this->con->prepare("SELECT `id`, `added_by`, `work_update_title`, `work_update_description`, `status`, `date`, `time` FROM `work_list`"))
			{	
				$stmt_insert->bind_result($res_id,$added_by,$work_update_title,$work_update_description,$status,$date,$time);
				
				if($stmt_insert->execute())
				{
					$counter	=	0;
					$details	=	array();
					while($stmt_insert->fetch())
					{
						
						$details[$counter][0]	=	$res_id;
						$details[$counter][1]	=	$added_by;
						$details[$counter][2]	=	$work_update_title;
						$details[$counter][3]	=	$work_update_description;
						$details[$counter][4]	=	$status;
						$details[$counter][5]	=	$date;
						$details[$counter][6]	=	$time;					
					
						$counter++;
					}
					if(!empty($details))	
					{
						return $details;
					}
					return false;
				}	
			}
		}
		
		function update_work_list_record($added_by,$work_update_title,$work_update_description,$status,$res_edit_id)
		{ 
			$date = date("Y-m-d");
			$time = date("H-i-s A");
			
			if($stmt_insert = $this->con->prepare("UPDATE `work_list` SET `added_by`=?,`work_update_title`=?,`work_update_description`=?,`status`=?,`date`=?,`time`=?  WHERE `id`= ?"))
			{ 
				$stmt_insert->bind_param("ssssssi",$added_by,$work_update_title,$work_update_description,$status,$date,$time,$res_edit_id);
				
				if($stmt_insert->execute())
				{
					return true;
				}
				return false;
			} 	
		}
		
		function get_work_list_data_from_id($res_edit_id)
		{ 
        if($stmt = $this->con->prepare("SELECT `id`, `added_by`, `work_update_title`, `work_update_description`, `status`, `date`, `time` FROM `work_list` WHERE `id`=?"))
		{
            $stmt->bind_param("i",$res_edit_id);
            $stmt->bind_result($res_id,$added_by,$work_update_title,$work_update_description,$status,$date,$time);
				
			if($stmt->execute())
			{
				$users_data = array();
				$counter = 0;
			}
			while($stmt->fetch())
			{ 
            $users_data['id'] 						= $res_id;
			$users_data['added_by'] 				= $added_by;
			$users_data['work_update_title'] 		= $work_update_title;
			$users_data['work_update_description'] 	= $work_update_description;
			$users_data['status']					= $status;
			$users_data['date']						= $date;
			$users_data['time'] 					= $time;
            }
                if(!empty($users_data))
				{
                    return $users_data;
                }
                else
				{
                    return false;
        }
    }
		}
		
	/*<!------------------------------------------------end code work------------------------------------------------------->*/


	
function insert_hall_name($function_hall_id, $hall_name) {
    $date = date("Y-m-d");
    $time = date("H-i-s A");

    if ($stmt_insert = $this->con->prepare("INSERT INTO `hall_master`(`function_hall_id`, `hall_name`, `date`, `time`) VALUES (?,?,?,?)")) {
        $stmt_insert->bind_param("ssss", $function_hall_id, $hall_name, $date, $time);

        if ($stmt_insert->execute()) {
            return true;
        }
        return false;
    }
}

		
		
function get_all_hall_names() {
    if ($stmt_select = $this->con->prepare("SELECT `id`, `function_hall_id`, `hall_name`, `date`, `time` FROM `hall_master`")) {    
        $stmt_select->bind_result($id, $function_hall_id, $hall_name, $date, $time);

        if ($stmt_select->execute()) {
            $stmt_select->store_result();
            $counter = 0;
            $details = array();
            while ($stmt_select->fetch()) {
                $details[$counter][0] = $id;
                $details[$counter][1] = $function_hall_id;
                $details[$counter][2] = $hall_name;
                $details[$counter][3] = $date;
                $details[$counter][4] = $time;
                $counter++;
            }
            if (!empty($details)) {
                return $details;
            }
            return false;
        }
    }
}


function delete_hall_name($delete_id)
		{
			if($stmt_select = $this->con->prepare("DELETE FROM `hall_master` WHERE `id`=?"))
			{
				$stmt_select->bind_param("i",$delete_id);
			
				if($stmt_select->execute())
				{					
						return true;
				}
					return false;
			}
		}
		


 function update_hall_names($function_hall_id, $hall_name, $res_edit_id) {
        $date = date("Y-m-d");
        $time = date("H:i:s A");

        if ($stmt_insert = $this->con->prepare("UPDATE `hall_master` SET `function_hall_id`=?, `hall_name`=?, `date`=?, `time`=? WHERE `id`=?")) {
            $stmt_insert->bind_param("ssssi", $function_hall_id, $hall_name, $date, $time, $res_edit_id);

            if ($stmt_insert->execute()) {
                return true;
            }
            return false;
        } else {
            return false;
        }
    }

    function get_hall_name_from_id($res_edit_id) {
        if ($stmt = $this->con->prepare("SELECT `id`, `function_hall_id`, `hall_name`, `date`, `time` FROM `hall_master` WHERE `id`=?")) {
            $stmt->bind_param("i", $res_edit_id);

            if ($stmt->execute()) {
                $stmt->bind_result($res_id, $function_hall_id, $hall_name, $date, $time);
                $users_data = array();

                while ($stmt->fetch()) {
                    $users_data['res_id'] = $res_id;
                    $users_data['function_hall_id'] = $function_hall_id;
                    $users_data['hall_name'] = $hall_name;
                    $users_data['date'] = $date;
                    $users_data['time'] = $time;
                }

                if (!empty($users_data)) {
                    return $users_data;
                } else {
                    return false;
                }
            } else {
                return false;
            }
        }
        return false;
    }


		
function insert_function_event($function_hall_id,$event_name) {
    $date = date("Y-m-d");
    $time = date("H-i-s A");

    if ($stmt_insert = $this->con->prepare("INSERT INTO `event_master`(`function_hall_id`, `event_name`, `date`, `time`) VALUES (?,?,?,?)")) {
        $stmt_insert->bind_param("ssss", $function_hall_id, $event_name, $date, $time);

        if ($stmt_insert->execute()) {
            return true;
        }
        return false;
    }
}


		
function get_all_function_event() {
    if ($stmt_select = $this->con->prepare("SELECT `id`, `function_hall_id`, `event_name`, `date`, `time` FROM `event_master`")) {    
        $stmt_select->bind_result($id, $function_hall_id, $event_name, $date, $time);

        if ($stmt_select->execute()) {
            $stmt_select->store_result();
            $counter = 0;
            $details = array();
            while ($stmt_select->fetch()) {
                $details[$counter][0] = $id;
                $details[$counter][1] = $function_hall_id;
                $details[$counter][2] = $event_name;
                $details[$counter][3] = $date;
                $details[$counter][4] = $time;
                $counter++;
            }
            if (!empty($details)) {
                return $details;
            }
            return false;
        }
    }
}


function delete_function_event($delete_id)
		{
			if($stmt_select = $this->con->prepare("DELETE FROM `event_master` WHERE `id`=?"))
			{
				$stmt_select->bind_param("i",$delete_id);
			
				if($stmt_select->execute())
				{					
						return true;
				}
					return false;
			}
		}
		


 function update_function_event($function_hall_id,$event_name,$res_edit_id) {
        $date = date("Y-m-d");
        $time = date("H:i:s A");

        if ($stmt_insert = $this->con->prepare("UPDATE `event_master` SET `function_hall_id`=?, `event_name`=?, `date`=?, `time`=? WHERE `id`=?")) {
            $stmt_insert->bind_param("ssssi", $function_hall_id, $event_name, $date, $time, $res_edit_id);

            if ($stmt_insert->execute()) {
                return true;
            }
            return false;
        } else {
            return false;
        }
    }

    function get_function_event_from_id($res_edit_id) 
	{
        if ($stmt = $this->con->prepare("SELECT `id`, `function_hall_id`, `event_name`, `date`, `time` FROM `event_master` WHERE `id`=?"))
			{
            $stmt->bind_param("i", $res_edit_id);

            if ($stmt->execute()) 
			{
                $stmt->bind_result($res_id, $function_hall_id, $event_name, $date, $time);
                $users_data = array();

                while ($stmt->fetch())
					{
                    $users_data['res_id'] = $res_id;
                    $users_data['function_hall_id'] = $function_hall_id;
                    $users_data['event_name'] = $event_name;
                    $users_data['date'] = $date;
                    $users_data['time'] = $time;
                }

                if (!empty($users_data))
					{
                    return $users_data;
                } else {
                    return false;
                }
            } else {
                return false;
            }
        }
        return false;
    }
		function add_event_booking($function_hall_id,$hall_name,$hall_type,$booking_date_from,$booking_date_to,$booking_for,$contact_name,$mobile_no,$address,$total_amount,$status,$others_2,$others_3,$others_4,$others_5)
		
		{
			$date = date("Y-m-d");
			$time = date("H-i-s A");
			
			if($stmt_insert = $this->con->prepare("INSERT INTO `add_booking`( `function_hall_id`, `hall_name`, `hall_type`, `booking_date_from`, `booking_date_to`, `booking_for`, `contact_name`, `mobile_no`, `address`, `total_amount`, `status`, `others_2`, `others_3`, `others_4`, `others_5`, `date`, `time`) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"))
			{
				$stmt_insert->bind_param("sssssssssssssssss",$function_hall_id,$hall_name,$hall_type,$booking_date_from,$booking_date_to,$booking_for,$contact_name,$mobile_no,$address,$total_amount,$status,$others_2,$others_3,$others_4,$others_5,$date,$time);
				
				if($stmt_insert->execute())
				{
					return true;
				}
					return false;
			} 	
		}
		
		function get_all_event_booking()
		
		{
			if($stmt_insert = $this->con->prepare("SELECT `id`, `function_hall_id`, `hall_name`, `hall_type`, `booking_date_from`, `booking_date_to`, `booking_for`, `contact_name`, `mobile_no`, `address`, `total_amount`,  `status`,`date`, `time` FROM `add_booking`"))
			{	
				$stmt_insert->bind_result($id,$function_hall_id,$hall_name,$hall_type,$booking_date_from,$booking_date_to,$booking_for,$contact_name,$mobile_no,$address,$total_amount,$status,$date,$time);
				
				if($stmt_insert->execute())
				{
					$counter	=	0;
					$details	=	array();
					while($stmt_insert->fetch())
					{
						
						$details[$counter][0]	=	$id;
						$details[$counter][1]	=	$function_hall_id;
						$details[$counter][2]	=	$hall_name;
						$details[$counter][3]	=	$hall_type;
						$details[$counter][4]	=	$booking_date_from;
						$details[$counter][5]	=	$booking_date_to;	
						$details[$counter][6]	=	$booking_for;
						$details[$counter][7]	=	$contact_name;
						$details[$counter][8]	=	$mobile_no;
						$details[$counter][9]	=	$address;
						$details[$counter][10]	=	$total_amount;
						$details[$counter][11]	=	$status;
						$details[$counter][12]	=	$date;
						$details[$counter][13]	=	$time;					
					
						$counter++;
					}
					if(!empty($details))	
					{
						return $details;
					}
					return false;
				}	
			}
		}
		
		
		
		
		
		function update_event_booking($function_hall_id,$hall_name,$hall_type,$booking_date_from,$booking_date_to,$booking_for,$contact_name,$mobile_no,$address,$total_amount,$status,$res_edit_id)
		{
    $date = date("Y-m-d");
    $time = date("H-i-s A");

    if ($stmt_insert = $this->con->prepare("UPDATE `add_booking` SET `function_hall_id`=?,`hall_name`=?,`hall_type`=?,`booking_date_from`=?,`booking_date_to`=?,`booking_for`=?,`contact_name`=?,`mobile_no`=?,`address`=?,`total_amount`=?,`status`=?,`date`=?,`time`=? WHERE  `id`=?")) 
	{
        $stmt_insert->bind_param("sssssssssssssi",$function_hall_id,$hall_name,$hall_type,$booking_date_from,$booking_date_to,$booking_for,$contact_name,$mobile_no,$address,$total_amount, $status,$date, $time, $res_edit_id);
        
        if ($stmt_insert->execute()) 
		{
            return true;
        } else {
            return false;
        }
    } else {
        return false;
    }
}

		function get_event_booking_from_id($res_edit_id)
		{ 
        if($stmt = $this->con->prepare(" SELECT `id`, `function_hall_id`, `hall_name`, `hall_type`, `booking_date_from`, `booking_date_to`, `booking_for`, `contact_name`, `mobile_no`, `address`, `total_amount`,`status`, `date`, `time` FROM `add_booking` WHERE `id`=?"))
		{ 
            $stmt->bind_param("i",$res_edit_id);
            $stmt->bind_result($id,$function_hall_id,$hall_name,$hall_type,$booking_date_from,$booking_date_to,$booking_for,$contact_name,$mobile_no,$address,$total_amount,$status,$date,$time);
				
			if($stmt->execute())
			{ 
				$users_data = array();
				$counter = 0;
			} 
			while($stmt->fetch())
			{ 
           		$users_data['id']             					=   $id;								
				$users_data['function_hall_id']      				  =  $function_hall_id;					
				$users_data['hall_name']             		   =   $hall_name;	
	            $users_data['hall_type']                		=   $hall_type;					
				$users_data['booking_date_from']              	 =   $booking_date_from;						
				$users_data['booking_date_to']           	   	 =   $booking_date_to;					
				$users_data['booking_for']            	   		 =   $booking_for;				
				$users_data['contact_name']             		  =   $contact_name;
				$users_data['mobile_no']           			 =   $mobile_no;							
				$users_data['address']           			 =   $address;	
                $users_data['total_amount']                =   $total_amount;		
				$users_data['status']                 =   $status;							
				$users_data['date']                 =   $date;							
				$users_data['time']                 =   $time;						
			}
                if(!empty($users_data))
				{
                    return $users_data;
                }
                else
				{
                    return false;
                }
        }
    }
	
	
	function save_user_payment($receipt_id,$total_amount,$discount_amount,$payable_amount,$paid_amount,$balance_amount,$payment_type,$payment_remark)
		{ 
			$date = date("Y-m-d");
			$time = date("H-i-s A");
						echo 7777;
			if($stmt_insert = $this->con->prepare("INSERT INTO `user_payment`(`receipt_id`, `total_amount`, `discount_amount`, `payable_amount`, `paid_amount`, `balance_amount`, `payment_type`, `payment_remark`, `date`, `time`) VALUES (?,?,?,?,?,?,?,?,?,?)"))
			{ 
				echo 888;
				$stmt_insert->bind_param("ssssssssss",$receipt_id,$total_amount,$discount_amount,$payable_amount,$paid_amount,$balance_amount,$payment_type,$payment_remark,$date,$time);
				
				if($stmt_insert->execute())
				{ 
					return true;
				} 
				return false;
			} 	
		}
		
		function get_current_balance_amount_from_receipt_id($var_receipt_id)
		{
			if($stmt_select = $this->con->prepare("Select `balance_amount` from `user_payment` where `receipt_id` = ? ORDER BY `id` DESC"))
			{
				$stmt_select->bind_param("s",$var_receipt_id);
			
				$stmt_select->bind_result($result_balance_amount);
			
				if($stmt_select->execute())
				{
					if($stmt_select->fetch())
					{
						return $result_balance_amount;
					}
				}
				return false;
			}
		}
		
		function get_all_pending_measurements_from_dates($customer_name,$mobile_number,$from_date,$to_date)
		{

			
			$customer_name_statement = "";

			if($customer_name!="")
			{
				$customer_name_statement = " AND `customer_name` LIKE '%".$customer_name."%'";
			}

			$statement_mobile_number = "";
			if($mobile_number!="")
			{
			
				$statement_mobile_number = " AND `mobile_number` LIKE '%".$mobile_number."%'";
			}
			

			if($stmt_insert = $this->con->prepare("SELECT id, customer_name, `address`, shirt1, shirt2, shirt3, shirt4, shirt5, shirt6, shirt7, shirt8, shirt9, shirt10, shirt11, shirt12, shirt13, shirt14, shirt15, shirt16, shirt17, shirt18, cup_size, cup_style, shirt_style, shirt_size, patti, shirt_design, collar, shirt_remark, pant1, pant2, pant3, pant4, pant5, pant6, pant7, pant8, pant9, pant10, pant11, pant12, pocket_size, back_pocket, watch_pocket, mobile_pocket, bottom_style, plate, pocket, iron, stitching, pant_remark, mobile_number, delivery_date, total_amount, discount, payable_amount, paid_amount, balance_amount, delivery_status, payment_method, date, time FROM shirt_measurement WHERE (`delivery_date` between ? AND ?) AND `delivery_status`='Pending'".$customer_name_statement.$statement_mobile_number))
			{	
				$stmt_insert->bind_param("ss",$from_date,$to_date,);

				$stmt_insert->bind_result($id,$customer_name,$address,$shirt1,$shirt2,$shirt3,$shirt4,$shirt5,$shirt6,$shirt7,$shirt8,$shirt9,$shirt10,$shirt11,$shirt12,$shirt13,$shirt14,$shirt15,$shirt16,$shirt17,$shirt18,$cup_size,$cup_style,$shirt_style,$shirt_size,$patti,$shirt_design,$collar,$shirt_remark,$pant1,$pant2,$pant3,$pant4,$pant5,$pant6,$pant7,$pant8,$pant9,$pant10,$pant11,$pant12,$pocket_size,$back_pocket,$watch_pocket,$mobile_pocket,$bottom_style,$plate,$pocket,$iron,$stitching,$pant_remark,$mobile_number,$delivery_date,$total_amount,$discount,$payable_amount,$paid_amount,$balance_amount,$delivery_status,$payment_method,$date,$time);

				// $stmt_insert->bind_param($receipt_id,$mobile_no,$from_date,$to_date);
				
				if($stmt_insert->execute())
				{
					$counter	=	0;
					$details	=	array();
					while($stmt_insert->fetch())
					{
						$details[$counter][0]	=	$id;
						// $details[$counter]	=	$measurement_for;
						$details[$counter][1]	=	$customer_name;
						$details[$counter][2]	=	$address;
						$details[$counter][3]	=	$shirt1;
						$details[$counter][4]	=	$shirt2;
						$details[$counter][5]	=	$shirt3;
						$details[$counter][6]	=	$shirt4;
						$details[$counter][7]	=	$shirt5;
						$details[$counter][8]	=	$shirt6;
						$details[$counter][9]	=	$shirt7;
						$details[$counter][10]	=	$shirt8;
						$details[$counter][11]	=	$shirt9;
						$details[$counter][12]	=	$shirt10;
						$details[$counter][13]	=	$shirt11;
						$details[$counter][14]	=	$shirt12;
						$details[$counter][15]	=	$shirt13;
						$details[$counter][16]	=	$shirt14;
						$details[$counter][17]	=	$shirt15;
						$details[$counter][18]	=	$shirt16;
						$details[$counter][19]	=	$shirt17;
						$details[$counter][20]	=	$shirt18;
						$details[$counter][21]	=	$cup_size;
						$details[$counter][22]	=	$cup_style;
						$details[$counter][23]	=	$shirt_style;
						$details[$counter][24]	=	$shirt_size;
						$details[$counter][25]	=	$patti;
						$details[$counter][26]	=	$shirt_design;
						$details[$counter][27]	=	$collar;
						$details[$counter][28]	=	$shirt_remark;
						$details[$counter][29]	=	$pant1;
						$details[$counter][30]	=	$pant2;
						$details[$counter][31]	=	$pant3;
						$details[$counter][32]	=	$pant4;
						$details[$counter][33]	=	$pant5;
						$details[$counter][34]	=	$pant6;
						$details[$counter][35]	=	$pant7;
						$details[$counter][36]	=	$pant8;
						$details[$counter][37]	=	$pant9;
						$details[$counter][38]	=	$pant10;
						$details[$counter][39]	=	$pant11;
						$details[$counter][40]	=	$pant12;
						$details[$counter][41]	=	$pocket_size;
						$details[$counter][42]	=	$back_pocket;
						$details[$counter][43]	=	$watch_pocket;
						$details[$counter][44]	=	$mobile_pocket;
						$details[$counter][45]	=	$bottom_style;
						$details[$counter][46]	=	$plate;
						$details[$counter][47]	=	$pocket;
						$details[$counter][48]	=	$iron;
						$details[$counter][49]	=	$stitching;
						$details[$counter][50]	=	$pant_remark;
						$details[$counter][51]	=	$mobile_number;
						$details[$counter][52]	=	$delivery_date;
						$details[$counter][53]	=	$total_amount;
						$details[$counter][54]	=	$discount;
						$details[$counter][55]	=	$payable_amount;
						$details[$counter][56]	=	$paid_amount;
						$details[$counter][57]	=	$balance_amount;
						$details[$counter][58]	=	$delivery_status;
						$details[$counter][59]	=	$payment_method;
						$details[$counter][60]	=	$date;
						$details[$counter][61]	=	$time;
						
						$counter++;
					}
					if(!empty($details))	
					{
						return $details;
					}
					return false;
				}	
			}
		}
		
		function get_function_event_by_id($hall_name)
		{
			
			if($stmt_insert = $this->con->prepare("SELECT `hall_name` FROM `hall_master` WHERE `id`=?"))
			{	
				$stmt_insert->bind_param("i",$hall_name);
				
				$stmt_insert->bind_result($res_select_course);
				
				if($stmt_insert->execute())
				{
					if($stmt_insert->fetch())
					{
						return $res_select_course;
					}
					return false;
				}	
			}
		}
		
		function get_function_booking_for_by_id($booking_for)
		{
			
			if($stmt_insert = $this->con->prepare("SELECT `event_name` FROM `event_master` WHERE `id`=?"))
			{	
				$stmt_insert->bind_param("i",$booking_for);
				
				$stmt_insert->bind_result($res_select_course);
				
				if($stmt_insert->execute())
				{
					if($stmt_insert->fetch())
					{
						return $res_select_course;
					}
					return false;
				}	
			}
		}
		
		function get_function_hall_by_id($function_hall_id)
		{
			
			if($stmt_insert = $this->con->prepare("SELECT `function_hall_id` FROM `hall_master` WHERE `id`=?"))
			{	
				$stmt_insert->bind_param("i",$function_hall_id);
				
				$stmt_insert->bind_result($res_select_course);
				
				if($stmt_insert->execute())
				{
					if($stmt_insert->fetch())
					{
						return $res_select_course;
					}
					return false;
				}	
			}
		}
		
			function add_follow_up_record($receipt_id,$total_amount,$discount,$payable_amount,$paid_amount,$balance_amount,$payment_type,$payment_remark)
		{ 
			$date = date("Y-m-d");
			$time = date("H-i-s A");
						
			if($stmt_insert = $this->con->prepare("INSERT INTO `user_payment`(`receipt_id`, `total_amount`, `discount`, `payable_amount`, `paid_amount`, `balance_amount`, `payment_type`, `payment_remark`, `date`, `time`) VALUES (?,?,?,?,?,?,?,?,?,?)"))
			{ 
				$stmt_insert->bind_param("ssssssssss",$receipt_id,$total_amount,$discount,$payable_amount,$paid_amount,$balance_amount,$payment_type,$payment_remark,$date,$time);
				
				if($stmt_insert->execute())
				{ 
					return true;
				} 
				return false;
			} 	
		}

function get_all_follow_up_details()
		{
			
			if($stmt_insert = $this->con->prepare("SELECT `id`, `follow_id`, `title`, `description`, `next_follow_id`, `date`, `time` FROM `follow_up`"))
			{	
				$stmt_insert->bind_result($id,$follow_id,$titel,$desc,$next_follow_date,$date,$time);
				
				if($stmt_insert->execute())
				{
					$counter	=	0;
					$details	=	array();
					while($stmt_insert->fetch())
					{
						$details[$counter][0]	=	$id;
						$details[$counter][1]	=	$follow_id;
						$details[$counter][2]	=	$titel;
						$details[$counter][3]	=	$desc;
						$details[$counter][4]	=	$next_follow_date;
						$details[$counter][5]	=	$date;
						$details[$counter][6]	=	$time;
	
						$counter++;
					}
					if(!empty($details))	
					{
						return $details;
					}
					return false;
				}	
			}
		}
	
		function delete_follow_up_record($delete_id)
		{
			if($stmt_select = $this->con->prepare("DELETE FROM `follow_up` WHERE `id`=?"))
			{
				$stmt_select->bind_param("i",$delete_id);
			
				if($stmt_select->execute())
				{					
						return true;
				}
					return false;
			}
		}



function get_follow_up_from_id($res_edit_id)
		{
			if($stmt = $this->con->prepare("SELECT `id`, `follow_id`, `title`, `description`, `next_follow_id`, `date`, `time` FROM `follow_up` WHERE  `id`=?"))
		{ 
            $stmt->bind_param("i",$res_edit_id);
            $stmt->bind_result($res_id,$follow_id,$titel,$desc,$next_follow_date,$date,$time);
				
			if($stmt->execute())
			{ 
				$users_data = array();
				$counter = 0;
			} 
			while($stmt->fetch())
			{ 
           		$users_data['id']             	=   $res_id;								
				
				$users_data['follow_id']         =   $follow_id;							
				$users_data['title']                 =   $titel;

				$users_data['description']                 =   $desc;							
				$users_data['next_follow_date']                 =   $next_follow_date;		
				$users_data['date']                 =   $date;							
				$users_data['time']                 =   $time;		
			}
                if(!empty($users_data))
				{
                    return $users_data;
                }
                else
				{
                    return false;
                }
        }
		}
		
		function save_follow_up_data($follow_id,$titel,$desc,$next_follow_date)
		{ 
			$date = date("Y-m-d");
			$time = date("H-i-s A");

			if($stmt_insert = $this->con->prepare("INSERT INTO `follow_up`(`follow_id`, `title`, `description`, `next_follow_id`, `date`, `time`) VALUES (?,?,?,?,?,?)"))
			{ 

				$stmt_insert->bind_param("ssssss",$follow_id,$titel,$desc,$next_follow_date,$date,$time);
				
				if($stmt_insert->execute())
				{ 
					return true;
				} 
				return false;
			} 	
		}
		
		

function edit_follow_up_data($title,$desc,$next_follow_date,$res_edit_id)
		{
			$date = date("Y-m-d");
			$time = date("H-i-s A");
			
			if($stmt_insert = $this->con->prepare("UPDATE `follow_up` SET  `title`=?,`description`=?,`next_follow_id`=?,`date`=?,`time`=? WHERE   `id`=?"))
			{
				$stmt_insert->bind_param("sssssi",$title,$desc,$next_follow_date,$date,$time,$res_edit_id);
				
				if($stmt_insert->execute())
				{
					return true;
				}
					return false;
			} 	
		}
		
		
		function insert_hall_registration($hall_name,$city,$state,$pincode,$address,$mobile_1,$mobile_2,$person_name,$email_id,$user_id,$password)
		{
			$date = date("Y-m-d");
			$time = date("H-i-s A");
			
			if($stmt_insert = $this->con->prepare("INSERT INTO `hall_registration`( `hall_name`, `Address`, `city`, `state`, `pincode`, `mobile_1`, `mobile_2`, `person_name`, `email_id`, `user_id`, `password`, `date`, `time`) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?)"))
			{
				$stmt_insert->bind_param("sssssssssssss",$hall_name,$city,$state,$pincode,$address,$mobile_1,$mobile_2,$person_name,$email_id,$user_id,$password,$date,$time);
				
				if($stmt_insert->execute())
				{
					return true;
				}
					return false;
			} 	
		}
		
		
		function get_all_hall_registration_data()
		{
			
			if($stmt_insert = $this->con->prepare("SELECT `id`, `hall_name`, `Address`, `city`, `state`, `pincode`, `mobile_1`, `mobile_2`, `person_name`, `email_id`, `user_id`, `password`, `date`, `time` FROM `hall_registration`"))
			{	
				$stmt_insert->bind_result($id,$hall_name,$city,$state,$pincode,$address,$mobile_1,$mobile_2,$person_name,$email_id,$user_id,$password,$date,$time);
				
				if($stmt_insert->execute())
				{
					$counter	=	0;
					$details	=	array();
					while($stmt_insert->fetch())
					{
						$details[$counter][0]	=	$id;
						$details[$counter][1]	=	$hall_name;
						$details[$counter][2]	=	$city;
						$details[$counter][3]	=	$state;
						$details[$counter][4]	=	$pincode;
						$details[$counter][5]	=	$address;
						$details[$counter][6]	=	$mobile_1;
						$details[$counter][7]	=	$mobile_2;
						$details[$counter][8]	=	$person_name;
						$details[$counter][9]	=	$email_id;
						$details[$counter][10]	=	$user_id;
						$details[$counter][11]	=	$password;
						$details[$counter][12]	=	$date;
						$details[$counter][13]	=	$time;
	
						$counter++;
					}
					if(!empty($details))	
					{
						return $details;
					}
					return false;
				}	
			}
		}
		
		
		
		function delete_hall_registration_record($delete_id)
		{
			if($stmt_select = $this->con->prepare("DELETE FROM `hall_registration` WHERE `id`=?"))
			{
				$stmt_select->bind_param("i",$delete_id);
			
				if($stmt_select->execute())
				{					
						return true;
				}
					return false;
			}
		}
		
		function update_hall_registration($hall_name,$city,$state,$pincode,$address,$mobile_1,$mobile_2,$person_name,$email_id,$user_id,$password,$res_edit_id)
		{
			$date = date("Y-m-d");
			$time = date("H-i-s A");
			
			if($stmt_insert = $this->con->prepare("UPDATE `hall_registration` SET `hall_name`=?,`Address`=?,`city`=?,`state`=?,`pincode`=?,`mobile_1`=?,`mobile_2`=?,`person_name`=?,`email_id`=?,`user_id`=?,`password`=?,`date`=?,`time`=? WHERE `id`=?"))
			{
				$stmt_insert->bind_param("sssssssssssssi",$hall_name,$city,$state,$pincode,$address,$mobile_1,$mobile_2,$person_name,$email_id,$user_id,$password,$date,$time,$res_edit_id);
				
				if($stmt_insert->execute())
				{
					return true;
				}
				return false;
			} 	
		}
		
		
		
		function get_hall_registration_data_from_id($res_edit_id)
		{ 
        if($stmt = $this->con->prepare("SELECT `id`, `hall_name`, `Address`, `city`, `state`, `pincode`, `mobile_1`, `mobile_2`, `person_name`, `email_id`, `user_id`, `password`, `date`, `time` FROM `hall_registration` WHERE `id`=?"))
		{
            $stmt->bind_param("i",$res_edit_id);
            $stmt->bind_result($id,$hall_name,$city,$state,$pincode,$address,$mobile_1,$mobile_2,$person_name,$email_id,$user_id,$password,$date,$time);
				
			if($stmt->execute())
			{
				$users_data = array();
				$counter = 0;
			}
			while($stmt->fetch())
			{ 
            $users_data['id'] 							= $id;
			$users_data['hall_name'] 					= $hall_name;
			$users_data['Address'] 						= $address;
			$users_data['city'] 						= $city;
			$users_data['state']						= $state;
			$users_data['pincode'] 						= $pincode;
			$users_data['mobile_1'] 					= $mobile_1;
			$users_data['mobile_2'] 					= $mobile_2;
			$users_data['person_name'] 					= $person_name;
			$users_data['email_id'] 					= $email_id;
			$users_data['user_id'] 						= $user_id;
			$users_data['password'] 					= $password;
			$users_data['date']							= $date;
			$users_data['time'] 						= $time;
            }
                if(!empty($users_data))
				{
                    return $users_data;
                }
                else
				{
                    return false;
                }
        }
    }
	
	
	
	function get_password_from_userid_code($userid_code)
		{
			if($stmt_select = $this->con->prepare("Select `password` from `hall_registration` where `user_id` = ? "))
			{
				$stmt_select->bind_param("s",$userid_code);
			
				$stmt_select->bind_result($result_password);
			
				if($stmt_select->execute())
				{
					if($stmt_select->fetch())
					{
						return $result_password;
					}
				}
				return false;
			}
		}
		
		function get_completed_projects()
		{
			if($stmt_select = $this->con->prepare("SELECT COUNT(`id`) FROM `add_booking` where `status` = 'Completed'"));
			{
				$stmt_select->bind_result($result_count);
			
				if($stmt_select->execute())
				{
					if($stmt_select->fetch())
					{
						return $result_count;
					}
				}
				return false;
			}
		}
        
		function get_pending_bookings()
		{
			if($stmt_select = $this->con->prepare("SELECT COUNT(`id`) FROM `add_booking` where `status` = 'Pending'"));
			{
				
				$stmt_select->bind_result($result_count);
			
				if($stmt_select->execute())
				{
					if($stmt_select->fetch())
					{
						return $result_count;
					}
				}
				return false;
			}
		}
		
		
		function get_all_event_booking_completed()
		
		{
			if($stmt_insert = $this->con->prepare("SELECT `id`, `function_hall_id`, `hall_name`, `hall_type`, `booking_date_from`, `booking_date_to`, `booking_for`, `contact_name`, `mobile_no`, `address`, `total_amount`,  `status`,`date`, `time` FROM `add_booking` where `status`='Completed'"))
			{	
				$stmt_insert->bind_result($id,$function_hall_id,$hall_name,$hall_type,$booking_date_from,$booking_date_to,$booking_for,$contact_name,$mobile_no,$address,$total_amount,$status,$date,$time);
				
				if($stmt_insert->execute())
				{
					$counter	=	0;
					$details	=	array();
					while($stmt_insert->fetch())
					{
						
						$details[$counter][0]	=	$id;
						$details[$counter][1]	=	$function_hall_id;
						$details[$counter][2]	=	$hall_name;
						$details[$counter][3]	=	$hall_type;
						$details[$counter][4]	=	$booking_date_from;
						$details[$counter][5]	=	$booking_date_to;	
						$details[$counter][6]	=	$booking_for;
						$details[$counter][7]	=	$contact_name;
						$details[$counter][8]	=	$mobile_no;
						$details[$counter][9]	=	$address;
						$details[$counter][10]	=	$total_amount;
						$details[$counter][11]	=	$status;
						$details[$counter][12]	=	$date;
						$details[$counter][13]	=	$time;					
					
						$counter++;
					}
					if(!empty($details))	
					{
						return $details;
					}
					return false;
				}	
			}
		}
		
		function delete_event_bookings($delete_id)
		{
			if($stmt_select = $this->con->prepare("DELETE FROM `add_booking` WHERE `id`=?"))
			{
				$stmt_select->bind_param("i",$delete_id);
			
				if($stmt_select->execute())
				{					
						return true;
				}
					return false;
			}
		}
		
		function get_all_event_booking_pending()
		
		{
			if($stmt_insert = $this->con->prepare("SELECT `id`, `function_hall_id`, `hall_name`, `hall_type`, `booking_date_from`, `booking_date_to`, `booking_for`, `contact_name`, `mobile_no`, `address`, `total_amount`,  `status`,`date`, `time` FROM `add_booking` where `status`='Pending'"))
			{	
				$stmt_insert->bind_result($id,$function_hall_id,$hall_name,$hall_type,$booking_date_from,$booking_date_to,$booking_for,$contact_name,$mobile_no,$address,$total_amount,$status,$date,$time);
				
				if($stmt_insert->execute())
				{
					$counter	=	0;
					$details	=	array();
					while($stmt_insert->fetch())
					{
						
						$details[$counter][0]	=	$id;
						$details[$counter][1]	=	$function_hall_id;
						$details[$counter][2]	=	$hall_name;
						$details[$counter][3]	=	$hall_type;
						$details[$counter][4]	=	$booking_date_from;
						$details[$counter][5]	=	$booking_date_to;	
						$details[$counter][6]	=	$booking_for;
						$details[$counter][7]	=	$contact_name;
						$details[$counter][8]	=	$mobile_no;
						$details[$counter][9]	=	$address;
						$details[$counter][10]	=	$total_amount;
						$details[$counter][11]	=	$status;
						$details[$counter][12]	=	$date;
						$details[$counter][13]	=	$time;					
					
						$counter++;
					}
					if(!empty($details))	
					{
						return $details;
					}
					return false;
				}	
			}
		}
		
		
		
		
		
		
		
		
		
		
		
		/*<!--------------------------------------------------B2B Flight--------------------------------------------->*/
		
			function add_register($company_name,$full_name,$phone_number,$whatsapp_number,$email_address,$referred_by,$country,$state,$district,$city,$address,$pin_code,$status,$your_locailty,$nearest_airport,$primary_business,$monthly_busines,$secondary_business,$monthly_business,$pan_no,$company_gst_no,$online_ota_1,$online_ota_2,$series_ota_1,$series_ota_2,$password,$wallet_balance,$adhar_number)
		
		{
			$date = date("Y-m-d");
			$time = date("H-i-s A");
			
			if($stmt_insert = $this->con->prepare("INSERT INTO `register`(`company_name`, `full_name`, `phone_number`, `whatsapp_number`, `email_address`, `referred_by`, `country`, `state`, `district`, `city`, `address`, `pin_code`, `status`, `your_locailty`, `nearest_airport`, `primary_business`, `monthly_busines`, `secondary_business`, `monthly_business`, `pan_no`, `company_gst_no`, `online_ota_1`, `online_ota_2`, `series_ota_1`, `series_ota_2`, `password`,`date`, `time`,`wallet_balance`,`adhar_number`) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"))
			{
				$stmt_insert->bind_param("ssssssssssssssssssssssssssssss",$company_name,$full_name,$phone_number,$whatsapp_number,$email_address,$referred_by,$country,$state,$district,$city,$address,$pin_code,$status,$your_locailty,$nearest_airport,$primary_business,$monthly_busines,$secondary_business,$monthly_business,$pan_no,$company_gst_no,$online_ota_1,$online_ota_2,$series_ota_1,$series_ota_2,$password,$date,$time,$wallet_balance,$adhar_number);
				
				if($stmt_insert->execute())
				{	
					return true;
				}
					return false;
			} 	
		}


		
		function delete_register($delete_id)
		{
			if($stmt_select = $this->con->prepare("DELETE FROM `register` WHERE `id`=?"))
			{
				$stmt_select->bind_param("i",$delete_id);
			
				if($stmt_select->execute())
				{					
						return true;
				}
					return false;
			}
		}
		
		function get_all_register()
		{


			if($stmt_insert = $this->con->prepare("SELECT `id`, `company_name`, `full_name`, `phone_number`, `whatsapp_number`, `email_address`, `referred_by`, `country`, `state`, `district`, `city`, `address`, `pin_code`, `status`, `your_locailty`, `nearest_airport`, `primary_business`, `monthly_busines`, `secondary_business`, `monthly_business`, `pan_no`, `company_gst_no`, `online_ota_1`, `online_ota_2`, `series_ota_1`, `series_ota_2`,`password`, `date`, `time`,`wallet_balance` FROM `register` WHERE `status` IN ('Active', 'Block')" ))
			{	
				$stmt_insert->bind_result($id,$company_name,$full_name,$phone_number,$whatsapp_number,$email_address,$referred_by,$country,$state,$district,$city,$address,$pin_code,$status,$your_locailty,$nearest_airport,$primary_business,$monthly_busines,$secondary_business,$monthly_business,$pan_no,$company_gst_no,$online_ota_1,$online_ota_2,$series_ota_1,$series_ota_2,$password,$date,$time,$wallet_balance);
				
				if($stmt_insert->execute())
				{
					$counter	=	0;
					$details	=	array();
					while($stmt_insert->fetch())
					{
						
						$details[$counter][0]	=	$id;
						$details[$counter][1]	=	$company_name;
						$details[$counter][2]	=	$full_name;
						$details[$counter][3]	=	$phone_number;
						$details[$counter][4]	=	$whatsapp_number;
						$details[$counter][5]	=	$email_address;
						$details[$counter][6]	=	$referred_by;	
						$details[$counter][7]	=	$country;
						$details[$counter][8]	=	$state;
						$details[$counter][9]	=	$district;
						$details[$counter][10]	=	$city;
						$details[$counter][11]	=	$address;
						$details[$counter][12]	=	$pin_code;
						$details[$counter][13]	=	$status;
						$details[$counter][14]	=	$your_locailty;
						$details[$counter][15]	=	$nearest_airport;
						$details[$counter][16]	=	$primary_business;
						$details[$counter][17]	=	$monthly_busines;
						$details[$counter][18]	=	$secondary_business;
						$details[$counter][19]	=	$monthly_business;
						$details[$counter][20]	=	$pan_no;
						$details[$counter][21]	=	$company_gst_no;
						$details[$counter][22]	=	$online_ota_1;
						$details[$counter][23]	=	$online_ota_2;
						$details[$counter][24]	=	$series_ota_1;
						$details[$counter][25]	=	$series_ota_2;
						$details[$counter][26]	=	$password;
						$details[$counter][27]	=	$date;
						$details[$counter][28]	=	$time;
						$details[$counter][29]	=	$wallet_balance;						
					
						$counter++;
					}
					if(!empty($details))	
					{
						return $details;
					}
					return false;
				}	
			}
		}
function get_all_register_for_search1($agent_name)
{
    $wcustomer_name_statement = "";

    if ($agent_name != "") {
        $wcustomer_name_statement = " AND `full_name` LIKE '%" . $agent_name . "%'";
    }
    $query = "SELECT `id`, `company_name`, `full_name`, `phone_number`, `whatsapp_number`, `email_address`, `referred_by`, `country`, `state`, `district`, `city`, `address`, `pin_code`, `status`, `your_locailty`, `nearest_airport`, `primary_business`, `monthly_busines`, `secondary_business`, `monthly_business`, `pan_no`, `company_gst_no`, `online_ota_1`, `online_ota_2`, `series_ota_1`, `series_ota_2`, `password`, `date`, `time`, `wallet_balance` FROM `register` WHERE `status` IN ('Active', 'Block')";

    if ($agent_name != "") {
        $query .= $wcustomer_name_statement;
    }

    if ($stmt_insert = $this->con->prepare($query)) {
        $stmt_insert->bind_result($id, $company_name, $full_name, $phone_number, $whatsapp_number, $email_address, $referred_by, $country, $state, $district, $city, $address, $pin_code, $status, $your_locailty, $nearest_airport, $primary_business, $monthly_busines, $secondary_business, $monthly_business, $pan_no, $company_gst_no, $online_ota_1, $online_ota_2, $series_ota_1, $series_ota_2, $password, $date, $time, $wallet_balance);
        
        if ($stmt_insert->execute()) {
            $counter = 0;
            $details = array();
            while ($stmt_insert->fetch()) {
                $details[$counter][0] = $id;
                $details[$counter][1] = $company_name;
                $details[$counter][2] = $full_name;
                $details[$counter][3] = $phone_number;
                $details[$counter][4] = $whatsapp_number;
                $details[$counter][5] = $email_address;
                $details[$counter][6] = $referred_by;
                $details[$counter][7] = $country;
                $details[$counter][8] = $state;
                $details[$counter][9] = $district;
                $details[$counter][10] = $city;
                $details[$counter][11] = $address;
                $details[$counter][12] = $pin_code;
                $details[$counter][13] = $status;
                $details[$counter][14] = $your_locailty;
                $details[$counter][15] = $nearest_airport;
                $details[$counter][16] = $primary_business;
                $details[$counter][17] = $monthly_busines;
                $details[$counter][18] = $secondary_business;
                $details[$counter][19] = $monthly_business;
                $details[$counter][20] = $pan_no;
                $details[$counter][21] = $company_gst_no;
                $details[$counter][22] = $online_ota_1;
                $details[$counter][23] = $online_ota_2;
                $details[$counter][24] = $series_ota_1;
                $details[$counter][25] = $series_ota_2;
                $details[$counter][26] = $password;
                $details[$counter][27] = $date;
                $details[$counter][28] = $time;
                $details[$counter][29] = $wallet_balance;

                $counter++;
            }
            if (!empty($details)) {
                return $details;
            }
            return false;
        }
    }
}



// function get_all_register_for_search($agent_name, $mobile_1, $city)
// {
//     // Start with a basic WHERE clause to ensure correct SQL syntax
//     $where_clause = " WHERE `status` IN ('Active', 'Block')";
    
//     // Add conditions dynamically based on input parameters
//     if ($agent_name != "") {
//         $where_clause .= " AND `full_name` LIKE ?";
//         $params[] = '%' . $agent_name . '%';
//     }
//     if ($mobile_1 != "") {
//         $where_clause .= " AND `phone_number` LIKE ?";
//         $params[] = '%' . $mobile_1 . '%';
//     }
//     if ($city != "") {
//         $where_clause .= " AND `city` LIKE ?";
//         $params[] = '%' . $city . '%';
//     }
    
//     $sql = "SELECT `id`, `company_name`, `full_name`, `phone_number`, `whatsapp_number`, `email_address`, `referred_by`, `country`, `state`, `district`, `city`, `address`, `pin_code`, `status`, `your_locailty`, `nearest_airport`, `primary_business`, `monthly_busines`, `secondary_business`, `monthly_business`, `pan_no`, `company_gst_no`, `online_ota_1`, `online_ota_2`, `series_ota_1`, `series_ota_2`, `password`, `date`, `time`, `wallet_balance` FROM `register`" . $where_clause;
    
//     if ($stmt_insert = $this->con->prepare($sql)) {
       
//         if (!empty($params)) {
//             $stmt_insert->bind_param(str_repeat('s', count($params)), ...$params);
//         }
        
//         $stmt_insert->execute();
        
//         $stmt_insert->bind_result($id, $company_name, $full_name, $phone_number, $whatsapp_number, $email_address, $referred_by, $country, $state, $district, $city, $address, $pin_code, $status, $your_locailty, $nearest_airport, $primary_business, $monthly_busines, $secondary_business, $monthly_business, $pan_no, $company_gst_no, $online_ota_1, $online_ota_2, $series_ota_1, $series_ota_2, $password, $date, $time, $wallet_balance);
        
//         $details = array();
//         while ($stmt_insert->fetch()) {
//             $details[] = array(
//                 $id, $company_name, $full_name, $phone_number, $whatsapp_number, $email_address, $referred_by, $country, $state, $district, $city, $address, $pin_code, $status, $your_locailty, $nearest_airport, $primary_business, $monthly_busines, $secondary_business, $monthly_business, $pan_no, $company_gst_no, $online_ota_1, $online_ota_2, $series_ota_1, $series_ota_2, $password, $date, $time, $wallet_balance
//             );
//         }
        
//         if (!empty($details)) {
//             return $details;
//         }
//         return false;
//     }
// }
// function get_all_register_for_search($agent_name, $mobile_1, $city)
// {
//     $wcustomer_name_statement = "";

//     if ($agent_name != "") {
//         $wcustomer_name_statement = "  `full_name` LIKE '%" . $agent_name . "%'";
//     }
//      $wcustomer_name_statement = "";

// 			if ($agent_name!="" && $agent_name != "Select")
// 			{
// 				$wcustomer_name_statement = " AND `full_name`= '".$agent_name."'";
// 			}
//     $wstatement_mobile_number = "";

//     if ($mobile_1 != "") {
//         $wstatement_mobile_number = " AND `phone_number` LIKE '%" . $mobile_1 . "%'";
//     }

//     $doctor_specialization = "";

//     if ($city != "") {	
//         $doctor_specialization = " AND `city` LIKE '%" . $city . "%'";
//     }

//     $query = "SELECT `id`, `company_name`, `full_name`, `phone_number`, `whatsapp_number`, `email_address`, `referred_by`, `country`, `state`, `district`, `city`, `address`, `pin_code`, `status`, `your_locailty`, `nearest_airport`, `primary_business`, `monthly_busines`, `secondary_business`, `monthly_business`, `pan_no`, `company_gst_no`, `online_ota_1`, `online_ota_2`, `series_ota_1`, `series_ota_2`, `password`, `date`, `time`, `wallet_balance` FROM `register` WHERE `status` IN ('Active', 'Block')";

//     if ($agent_name != "" || $mobile_1 != "" || $city != "") {
//         $query .= $wcustomer_name_statement . $wstatement_mobile_number . $doctor_specialization;
//     }

//     if ($stmt_insert = $this->con->prepare($query)) {
//         $stmt_insert->bind_result($id, $company_name, $full_name, $phone_number, $whatsapp_number, $email_address, $referred_by, $country, $state, $district, $city, $address, $pin_code, $status, $your_locailty, $nearest_airport, $primary_business, $monthly_busines, $secondary_business, $monthly_business, $pan_no, $company_gst_no, $online_ota_1, $online_ota_2, $series_ota_1, $series_ota_2, $password, $date, $time, $wallet_balance);
        
//         if ($stmt_insert->execute()) {
//             $counter = 0;
//             $details = array();
//             while ($stmt_insert->fetch()) {
//                 $details[$counter][0] = $id;
//                 $details[$counter][1] = $company_name;
//                 $details[$counter][2] = $full_name;
//                 $details[$counter][3] = $phone_number;
//                 $details[$counter][4] = $whatsapp_number;
//                 $details[$counter][5] = $email_address;
//                 $details[$counter][6] = $referred_by;
//                 $details[$counter][7] = $country;
//                 $details[$counter][8] = $state;
//                 $details[$counter][9] = $district;
//                 $details[$counter][10] = $city;
//                 $details[$counter][11] = $address;
//                 $details[$counter][12] = $pin_code;
//                 $details[$counter][13] = $status;
//                 $details[$counter][14] = $your_locailty;
//                 $details[$counter][15] = $nearest_airport;
//                 $details[$counter][16] = $primary_business;
//                 $details[$counter][17] = $monthly_busines;
//                 $details[$counter][18] = $secondary_business;
//                 $details[$counter][19] = $monthly_business;
//                 $details[$counter][20] = $pan_no;
//                 $details[$counter][21] = $company_gst_no;
//                 $details[$counter][22] = $online_ota_1;
//                 $details[$counter][23] = $online_ota_2;
//                 $details[$counter][24] = $series_ota_1;
//                 $details[$counter][25] = $series_ota_2;
//                 $details[$counter][26] = $password;
//                 $details[$counter][27] = $date;
//                 $details[$counter][28] = $time;
//                 $details[$counter][29] = $wallet_balance;

//                 $counter++;
//             }
//             if (!empty($details)) {
//                 return $details;
//             }
//             return false;
//         }
//     }
// }

function get_all_register_for_search($agent_name, $mobile_1, $city)
{
    // Initialize the base query
    $query = "SELECT `id`, `company_name`, `full_name`, `phone_number`, `whatsapp_number`, `email_address`, `referred_by`, `country`, `state`, `district`, `city`, `address`, `pin_code`, `status`, `your_locailty`, `nearest_airport`, `primary_business`, `monthly_busines`, `secondary_business`, `monthly_business`, `pan_no`, `company_gst_no`, `online_ota_1`, `online_ota_2`, `series_ota_1`, `series_ota_2`, `password`, `date`, `time`, `wallet_balance`,`adhar_number` FROM `register` WHERE `status` IN ('Active')";

    // Initialize the WHERE clause components
    $conditions = [];

    // Add conditions based on input parameters
    if ($agent_name != "") {
        $conditions[] = " `full_name` LIKE '%" . $agent_name . "%'";
    }

    if ($mobile_1 != "") {
        $conditions[] = " `phone_number` LIKE '%" . $mobile_1 . "%'";
    }

    if ($city != "") {
        $conditions[] = " `city` LIKE '%" . $city . "%'";
    }

    // If there are any conditions, append them to the query
    if (!empty($conditions)) {
        $query .= " AND " . implode(" AND ", $conditions);
    }

    // Prepare the statement
    if ($stmt_insert = $this->con->prepare($query)) {
        $stmt_insert->bind_result($id, $company_name, $full_name, $phone_number, $whatsapp_number, $email_address, $referred_by, $country, $state, $district, $city, $address, $pin_code, $status, $your_locailty, $nearest_airport, $primary_business, $monthly_busines, $secondary_business, $monthly_business, $pan_no, $company_gst_no, $online_ota_1, $online_ota_2, $series_ota_1, $series_ota_2, $password, $date, $time, $wallet_balance,$adhar_number);

        if ($stmt_insert->execute()) {
            $details = [];
            while ($stmt_insert->fetch()) {
                $details[] = [
                    $id, $company_name, $full_name, $phone_number, $whatsapp_number, $email_address, $referred_by, $country, $state, $district, $city, $address, $pin_code, $status, $your_locailty, $nearest_airport, $primary_business, $monthly_busines, $secondary_business, $monthly_business, $pan_no, $company_gst_no, $online_ota_1, $online_ota_2, $series_ota_1, $series_ota_2, $password, $date, $time, $wallet_balance,$adhar_number
                ];
            }
            return !empty($details) ? $details : false;
        }
    } else {
        // Handle SQL error
        echo "Error: " . $this->con->error;
    }
    return false;
}




		// function get_all_register_for_search($agent_name,$mobile_1,$city)
		
		// {
		// 	$wcustomer_name_statement = "";

		// 	if($agent_name!="")
		// 	{
		// 		$wcustomer_name_statement = " `company_name` LIKE '%".$agent_name."%'";
		// 	}

		// 	$wstatement_mobile_number = "";

		// 	if($mobile_1!="")
		// 	{
			
		// 		$wstatement_mobile_number = " AND  `mobile_1` LIKE '%".$mobile_1."%'";
		// 	}

		// 	$doctor_specialization = "";

		// 	if($city!="")
		// 	{
		// 		$doctor_specialization = " AND `city` LIKE '%".$city."%'";
		// 	}

		// 	if($stmt_insert = $this->con->prepare("SELECT `id`, `company_name`, `full_name`, `phone_number`, `whatsapp_number`, `email_address`, `referred_by`, `country`, `state`, `district`, `city`, `address`, `pin_code`, `status`, `your_locailty`, `nearest_airport`, `primary_business`, `monthly_busines`, `secondary_business`, `monthly_business`, `pan_no`, `company_gst_no`, `online_ota_1`, `online_ota_2`, `series_ota_1`, `series_ota_2`,`password`, `date`, `time`,`wallet_balance` FROM `register` WHERE `status` IN ('Active', 'Block')".$wcustomer_name_statement.$wstatement_mobile_number.$doctor_specialization))
		// 	{	
		// 		$stmt_insert->bind_result($id,$company_name,$full_name,$phone_number,$whatsapp_number,$email_address,$referred_by,$country,$state,$district,$city,$address,$pin_code,$status,$your_locailty,$nearest_airport,$primary_business,$monthly_busines,$secondary_business,$monthly_business,$pan_no,$company_gst_no,$online_ota_1,$online_ota_2,$series_ota_1,$series_ota_2,$password,$date,$time,$wallet_balance);
				
		// 		if($stmt_insert->execute())
		// 		{
		// 			$counter	=	0;
		// 			$details	=	array();
		// 			while($stmt_insert->fetch())
		// 			{
						
		// 				$details[$counter][0]	=	$id;
		// 				$details[$counter][1]	=	$company_name;
		// 				$details[$counter][2]	=	$full_name;
		// 				$details[$counter][3]	=	$phone_number;
		// 				$details[$counter][4]	=	$whatsapp_number;
		// 				$details[$counter][5]	=	$email_address;
		// 				$details[$counter][6]	=	$referred_by;	
		// 				$details[$counter][7]	=	$country;
		// 				$details[$counter][8]	=	$state;
		// 				$details[$counter][9]	=	$district;
		// 				$details[$counter][10]	=	$city;
		// 				$details[$counter][11]	=	$address;
		// 				$details[$counter][12]	=	$pin_code;
		// 				$details[$counter][13]	=	$status;
		// 				$details[$counter][14]	=	$your_locailty;
		// 				$details[$counter][15]	=	$nearest_airport;
		// 				$details[$counter][16]	=	$primary_business;
		// 				$details[$counter][17]	=	$monthly_busines;
		// 				$details[$counter][18]	=	$secondary_business;
		// 				$details[$counter][19]	=	$monthly_business;
		// 				$details[$counter][20]	=	$pan_no;
		// 				$details[$counter][21]	=	$company_gst_no;
		// 				$details[$counter][22]	=	$online_ota_1;
		// 				$details[$counter][23]	=	$online_ota_2;
		// 				$details[$counter][24]	=	$series_ota_1;
		// 				$details[$counter][25]	=	$series_ota_2;
		// 				$details[$counter][26]	=	$password;
		// 				$details[$counter][27]	=	$date;
		// 				$details[$counter][28]	=	$time;
		// 				$details[$counter][29]	=	$wallet_balance;						
					
		// 				$counter++;
		// 			}
		// 			if(!empty($details))	
		// 			{
		// 				return $details;
		// 			}
		// 			return false;
		// 		}	
		// 	}
		// }
		
		function get_all_register_for_profile($current_login_admin)
		
		{
			if($stmt_insert = $this->con->prepare("SELECT `id`, `company_name`, `full_name`, `phone_number`, `whatsapp_number`, `email_address`, `referred_by`, `country`, `state`, `district`, `city`, `address`, `pin_code`, `status`, `your_locailty`, `nearest_airport`, `primary_business`, `monthly_busines`, `secondary_business`, `monthly_business`, `pan_no`, `company_gst_no`, `online_ota_1`, `online_ota_2`, `series_ota_1`, `series_ota_2`,`password`, `date`, `time`,`wallet_balance` FROM `register` WHERE `phone_number`=?"))
			{	

				$stmt_insert->bind_param("i",$current_login_admin);
				$stmt_insert->bind_result($id,$company_name,$full_name,$phone_number,$whatsapp_number,$email_address,$referred_by,$country,$state,$district,$city,$address,$pin_code,$status,$your_locailty,$nearest_airport,$primary_business,$monthly_busines,$secondary_business,$monthly_business,$pan_no,$company_gst_no,$online_ota_1,$online_ota_2,$series_ota_1,$series_ota_2,$password,$date,$time,$wallet_balance);
				
				if($stmt_insert->execute())
				{
					$counter	=	0;
					$details	=	array();
					while($stmt_insert->fetch())
					{
						
						$details[$counter][0]	=	$id;
						$details[$counter][1]	=	$company_name;
						$details[$counter][2]	=	$full_name;
						$details[$counter][3]	=	$phone_number;
						$details[$counter][4]	=	$whatsapp_number;
						$details[$counter][5]	=	$email_address;
						$details[$counter][6]	=	$referred_by;	
						$details[$counter][7]	=	$country;
						$details[$counter][8]	=	$state;
						$details[$counter][9]	=	$district;
						$details[$counter][10]	=	$city;
						$details[$counter][11]	=	$address;
						$details[$counter][12]	=	$pin_code;
						$details[$counter][13]	=	$status;
						$details[$counter][14]	=	$your_locailty;
						$details[$counter][15]	=	$nearest_airport;
						$details[$counter][16]	=	$primary_business;
						$details[$counter][17]	=	$monthly_busines;
						$details[$counter][18]	=	$secondary_business;
						$details[$counter][19]	=	$monthly_business;
						$details[$counter][20]	=	$pan_no;
						$details[$counter][21]	=	$company_gst_no;
						$details[$counter][22]	=	$online_ota_1;
						$details[$counter][23]	=	$online_ota_2;
						$details[$counter][24]	=	$series_ota_1;
						$details[$counter][25]	=	$series_ota_2;
						$details[$counter][26]	=	$password;
						$details[$counter][27]	=	$date;
						$details[$counter][28]	=	$time;
						$details[$counter][29]	=	$wallet_balance;						
					
						$counter++;
					}
					if(!empty($details))	
					{
						return $details;
					}
					return false;
				}	
			}
		}
		function update_registration($company_name,$full_name,$phone_number,$whatsapp_number,$email_address,$referred_by,$country,$state,$district,$city,$address,$pin_code,$status,$your_locailty,$nearest_airport,$primary_business,$monthly_busines,$secondary_business,$monthly_business,$pan_no,$company_gst_no,$online_ota_1,$online_ota_2,$series_ota_1,$series_ota_2,$password,$adhar_number,$res_edit_id)
		{
			$date = date("Y-m-d");
			$time = date("H-i-s A");
			
			
			if($stmt_insert = $this->con->prepare("UPDATE `register` SET `company_name`=?,`full_name`=?,`phone_number`=?,`whatsapp_number`=?,`email_address`=?,`referred_by`=?,`country`=?,`state`=?,`district`=?,`city`=?,`address`=?,`pin_code`=?,`status`=?,`your_locailty`=?,`nearest_airport`=?,`primary_business`=?,`monthly_busines`=?,`secondary_business`=?,`monthly_business`=?,`pan_no`=?,`company_gst_no`=?,`online_ota_1`=?,`online_ota_2`=?,`series_ota_1`=?,`series_ota_2`=?,`password`=?,`date`=?,`time`=?,`adhar_number`=? WHERE `id`=?"))
			{
				$stmt_insert->bind_param("sssssssssssssssssssssssssssssi",$company_name,$full_name,$phone_number,$whatsapp_number,$email_address,$referred_by,$country,$state,$district,$city,$address,$pin_code,$status,$your_locailty,$nearest_airport,$primary_business,$monthly_busines,$secondary_business,$monthly_business,$pan_no,$company_gst_no,$online_ota_1,$online_ota_2,$series_ota_1,$series_ota_2,$password,$date,$time,$adhar_number,$res_edit_id);
				
				if($stmt_insert->execute())
				{
					return true;
				}
				return false;
			} 	
		}
		
		
		
		
		
		
	function get_registration_from_id($res_edit_id)
		{ 
        if($stmt = $this->con->prepare("SELECT `id`, `company_name`, `full_name`, `phone_number`, `whatsapp_number`, `email_address`, `referred_by`, `country`, `state`, `district`, `city`, `address`, `pin_code`, `status`, `your_locailty`, `nearest_airport`, `primary_business`, `monthly_busines`, `secondary_business`, `monthly_business`, `pan_no`, `company_gst_no`, `online_ota_1`, `online_ota_2`, `series_ota_1`, `series_ota_2`,`password`, `date`, `time`,`adhar_number` FROM `register` WHERE `id`=?"))
		{
            $stmt->bind_param("i",$res_edit_id);
            $stmt->bind_result($id,$company_name,$full_name,$phone_number,$whatsapp_number,$email_address,$referred_by,$country,$state,$district,$city,$address,$pin_code,$status,$your_locailty,$nearest_airport,$primary_business,$monthly_busines,$secondary_business,$monthly_business,$pan_no,$company_gst_no,$online_ota_1,$online_ota_2,$series_ota_1,$series_ota_2,$password,$date,$time,$adhar_number);
				
			if($stmt->execute())
			{
				$users_data = array();
				$counter = 0;
			}
			while($stmt->fetch())
			{ 
            $users_data['id'] 							= $id;
			$users_data['company_name'] 					= $company_name;
			$users_data['full_name'] 						= $full_name;
			$users_data['phone_number'] 						= $phone_number;
			$users_data['whatsapp_number']						= $whatsapp_number;
			$users_data['email_address'] 						= $email_address;
			$users_data['referred_by'] 					= $referred_by;
			$users_data['country'] 					= $country;
			$users_data['state'] 					= $state;
			$users_data['district'] 					= $district;
			$users_data['city'] 						= $city;
			$users_data['address'] 					= $address;
			$users_data['pin_code']							= $pin_code;
			$users_data['status'] 						= $status;
			$users_data['your_locailty'] 						= $your_locailty;
			$users_data['nearest_airport'] 					= $nearest_airport;
			$users_data['primary_business']							= $primary_business;
			$users_data['monthly_busines'] 						= $monthly_busines;
			$users_data['secondary_business'] 					= $secondary_business;
			$users_data['monthly_business'] 						= $monthly_business;
			$users_data['pan_no'] 					= $pan_no;
			$users_data['company_gst_no']							= $company_gst_no;
			$users_data['online_ota_1'] 						= $online_ota_1;
			$users_data['online_ota_2'] 						= $online_ota_2;
			$users_data['series_ota_1'] 					= $series_ota_1;
				$users_data['series_ota_2']							= $series_ota_2;
				$users_data['password']							= $password;
			$users_data['date']							= $date;
			$users_data['time'] 						= $time;
				$users_data['adhar_number'] 						= $adhar_number;
            }
                if(!empty($users_data))
				{
                    return $users_data;
                }
                else
				{
                    return false;
                }
        }
    }
	
	
	
			function set_status_register($id,$status) 
			{
			if ($stmt = $this->con->prepare("UPDATE register SET status = '$status' WHERE id = ?")) 
			{
				$stmt->bind_param('i', $id);

				if ($stmt->execute()) {
					$stmt->close();
					return true;
				} else {
					$stmt->close();
					return false;
				}
			}

			return false;
		}
	
		function set_status_pending($id,$status)
		{
			if ($stmt = $this->con->prepare("UPDATE register SET status = '$status' WHERE id = ?")) 
			{
				$stmt->bind_param('i', $id);

				if ($stmt->execute()) {
					$stmt->close();
					return true;
				} else {
					$stmt->close();
					return false;
				}
			}

			return false;
		}
		
		function set_status_block($id,$status)
		{
			if ($stmt = $this->con->prepare("UPDATE register SET status = '$status' WHERE id = ?")) 
			{
				$stmt->bind_param('i', $id);

				if ($stmt->execute()) {
					$stmt->close();
					return true;
				} else {
					$stmt->close();
					return false;
				}
			}

			return false;
		}
		
		
		function get_all_register_pending()
		
		{
			if($stmt_insert = $this->con->prepare("SELECT `id`, `company_name`, `full_name`, `phone_number`, `whatsapp_number`, `email_address`, `referred_by`, `country`, `state`, `district`, `city`, `address`, `pin_code`, `status`, `your_locailty`, `nearest_airport`, `primary_business`, `monthly_busines`, `secondary_business`, `monthly_business`, `pan_no`, `company_gst_no`, `online_ota_1`, `online_ota_2`, `series_ota_1`, `series_ota_2`,`password`, `date`, `time`,`wallet_balance` FROM `register` WHERE `status`='Pending'"))
			{	
				$stmt_insert->bind_result($id,$company_name,$full_name,$phone_number,$whatsapp_number,$email_address,$referred_by,$country,$state,$district,$city,$address,$pin_code,$status,$your_locailty,$nearest_airport,$primary_business,$monthly_busines,$secondary_business,$monthly_business,$pan_no,$company_gst_no,$online_ota_1,$online_ota_2,$series_ota_1,$series_ota_2,$password,$date,$time,$wallet_balance);
				
				if($stmt_insert->execute())
				{
					$counter	=	0;
					$details	=	array();
					while($stmt_insert->fetch())
					{
						
						$details[$counter][0]	=	$id;
						$details[$counter][1]	=	$company_name;
						$details[$counter][2]	=	$full_name;
						$details[$counter][3]	=	$phone_number;
						$details[$counter][4]	=	$whatsapp_number;
						$details[$counter][5]	=	$email_address;
						$details[$counter][6]	=	$referred_by;	
						$details[$counter][7]	=	$country;
						$details[$counter][8]	=	$state;
						$details[$counter][9]	=	$district;
						$details[$counter][10]	=	$city;
						$details[$counter][11]	=	$address;
						$details[$counter][12]	=	$pin_code;
						$details[$counter][13]	=	$status;
						$details[$counter][14]	=	$your_locailty;
						$details[$counter][15]	=	$nearest_airport;
						$details[$counter][16]	=	$primary_business;
						$details[$counter][17]	=	$monthly_busines;
						$details[$counter][18]	=	$secondary_business;
						$details[$counter][19]	=	$monthly_business;
						$details[$counter][20]	=	$pan_no;
						$details[$counter][21]	=	$company_gst_no;
						$details[$counter][22]	=	$online_ota_1;
						$details[$counter][23]	=	$online_ota_2;
						$details[$counter][24]	=	$series_ota_1;
						$details[$counter][25]	=	$series_ota_2;
						$details[$counter][26]	=	$password;
						$details[$counter][27]	=	$date;
						$details[$counter][28]	=	$time;
						$details[$counter][29]	=	$wallet_balance;						
					
						$counter++;
					}
					if(!empty($details))	
					{
						return $details;
					}
					return false;
				}	
			}
		}

		function get_all_register_pending_for_search($pagent_name,$pmobile_1,$pcity)		
		{

			$customer_name_statement = "";
			if($pagent_name!="")
			{
				$customer_name_statement = " AND `full_name` LIKE '%".$pagent_name."%'";
			}
			$customer_nu_statement = "";
			if($pmobile_1!="")
			{
				$customer_nu_statement = " AND `phone_number` LIKE '%".$pmobile_1."%'";
			}
			$customer_city_statement = "";
			if($pcity!="")
			{
				$customer_city_statement = " AND `city` LIKE '%".$pcity."%'";
			}
		

			if($stmt_insert = $this->con->prepare("SELECT `id`, `company_name`, `full_name`, `phone_number`, `whatsapp_number`, `email_address`, `referred_by`, `country`, `state`, `district`, `city`, `address`, `pin_code`, `status`, `your_locailty`, `nearest_airport`, `primary_business`, `monthly_busines`, `secondary_business`, `monthly_business`, `pan_no`, `company_gst_no`, `online_ota_1`, `online_ota_2`, `series_ota_1`, `series_ota_2`,`password`, `date`, `time`,`wallet_balance`,`adhar_number` FROM `register` WHERE `status`='Pending' ".$customer_name_statement .$customer_nu_statement .$customer_city_statement))
			{	
				$stmt_insert->bind_result($id,$company_name,$full_name,$phone_number,$whatsapp_number,$email_address,$referred_by,$country,$state,$district,$city,$address,$pin_code,$status,$your_locailty,$nearest_airport,$primary_business,$monthly_busines,$secondary_business,$monthly_business,$pan_no,$company_gst_no,$online_ota_1,$online_ota_2,$series_ota_1,$series_ota_2,$password,$date,$time,$wallet_balance,$adhar_number);
				
				if($stmt_insert->execute())
				{
					$counter	=	0;
					$details	=	array();
					while($stmt_insert->fetch())
					{
						
						$details[$counter][0]	=	$id;
						$details[$counter][1]	=	$company_name;
						$details[$counter][2]	=	$full_name;
						$details[$counter][3]	=	$phone_number;
						$details[$counter][4]	=	$whatsapp_number;
						$details[$counter][5]	=	$email_address;
						$details[$counter][6]	=	$referred_by;	
						$details[$counter][7]	=	$country;
						$details[$counter][8]	=	$state;
						$details[$counter][9]	=	$district;
						$details[$counter][10]	=	$city;
						$details[$counter][11]	=	$address;
						$details[$counter][12]	=	$pin_code;
						$details[$counter][13]	=	$status;
						$details[$counter][14]	=	$your_locailty;
						$details[$counter][15]	=	$nearest_airport;
						$details[$counter][16]	=	$primary_business;
						$details[$counter][17]	=	$monthly_busines;
						$details[$counter][18]	=	$secondary_business;
						$details[$counter][19]	=	$monthly_business;
						$details[$counter][20]	=	$pan_no;
						$details[$counter][21]	=	$company_gst_no;
						$details[$counter][22]	=	$online_ota_1;
						$details[$counter][23]	=	$online_ota_2;
						$details[$counter][24]	=	$series_ota_1;
						$details[$counter][25]	=	$series_ota_2;
						$details[$counter][26]	=	$password;
						$details[$counter][27]	=	$date;
						$details[$counter][28]	=	$time;
						$details[$counter][29]	=	$wallet_balance;			
						$details[$counter][30]	=	$adhar_number;			
					
						$counter++;
					}
					if(!empty($details))	
					{
						return $details;
					}
					return false;
				}	
			}
		}
// function get_all_register_pending_for_search($agent_name, $mobile_1, $city)
// {
//     // Initialize the WHERE clause array
//     $whereClauses = ["`status`='Pending'"];
//     $params = [];
//     $types = '';

//     // Append conditions based on the provided parameters
//     if ($agent_name != "") {
//         $whereClauses[] = "`full_name` LIKE ?";
//         $params[] = "%" . $agent_name . "%";
//         $types .= 's';
//     }

//     if ($mobile_1 != "") {
//         $whereClauses[] = "`phone_number` LIKE ?";
//         $params[] = "%" . $mobile_1 . "%";
//         $types .= 's';
//     }

//     if ($city != "") {
//         $whereClauses[] = "`city` LIKE ?";
//         $params[] = "%" . $city . "%";
//         $types .= 's';
//     }

//     // Combine the WHERE clause array into a single string
//     $whereSql = implode(" AND ", $whereClauses);

//     // Prepare the SQL statement
//     $query = "SELECT `id`, `company_name`, `full_name`, `phone_number`, `whatsapp_number`, `email_address`, `referred_by`, `country`, `state`, `district`, `city`, `address`, `pin_code`, `status`, `your_locailty`, `nearest_airport`, `primary_business`, `monthly_busines`, `secondary_business`, `monthly_business`, `pan_no`, `company_gst_no`, `online_ota_1`, `online_ota_2`, `series_ota_1`, `series_ota_2`, `password`, `date`, `time`, `wallet_balance` FROM `register` WHERE $whereSql";
    
//     if ($stmt = $this->con->prepare($query)) {
//         // Bind parameters
//         if ($params) {
//             $stmt->bind_param($types, ...$params);
//         }

//         // Execute the statement
//         if ($stmt->execute()) {
//             $stmt->bind_result($id, $company_name, $full_name, $phone_number, $whatsapp_number, $email_address, $referred_by, $country, $state, $district, $city, $address, $pin_code, $status, $your_locailty, $nearest_airport, $primary_business, $monthly_busines, $secondary_business, $monthly_business, $pan_no, $company_gst_no, $online_ota_1, $online_ota_2, $series_ota_1, $series_ota_2, $password, $date, $time, $wallet_balance);

//             $details = [];
//             while ($stmt->fetch()) {
//                 $details[] = [
//                     $id, $company_name, $full_name, $phone_number, $whatsapp_number, $email_address, $referred_by, $country, $state, $district, $city, $address, $pin_code, $status, $your_locailty, $nearest_airport, $primary_business, $monthly_busines, $secondary_business, $monthly_business, $pan_no, $company_gst_no, $online_ota_1, $online_ota_2, $series_ota_1, $series_ota_2, $password, $date, $time, $wallet_balance
//                 ];
//             }

//             // Check if we have any results
//             if (!empty($details)) {
//                 return $details;
//             }
//             return false;
//         }
//     }

//     // In case of an error
//     echo "Error: " . $this->con->error;
//     return false;
// }

		
		function get_all_register_block()
		
		{
			if($stmt_insert = $this->con->prepare("SELECT `id`, `company_name`, `full_name`, `phone_number`, `whatsapp_number`, `email_address`, `referred_by`, `country`, `state`, `district`, `city`, `address`, `pin_code`, `status`, `your_locailty`, `nearest_airport`, `primary_business`, `monthly_busines`, `secondary_business`, `monthly_business`, `pan_no`, `company_gst_no`, `online_ota_1`, `online_ota_2`, `series_ota_1`, `series_ota_2`,`password`, `date`, `time`,`wallet_balance` FROM `register` WHERE `status`='Block'"))
			{	
				$stmt_insert->bind_result($id,$company_name,$full_name,$phone_number,$whatsapp_number,$email_address,$referred_by,$country,$state,$district,$city,$address,$pin_code,$status,$your_locailty,$nearest_airport,$primary_business,$monthly_busines,$secondary_business,$monthly_business,$pan_no,$company_gst_no,$online_ota_1,$online_ota_2,$series_ota_1,$series_ota_2,$password,$date,$time,$wallet_balance);
				
				if($stmt_insert->execute())
				{
					$counter	=	0;
					$details	=	array();
					while($stmt_insert->fetch())
					{
						
						$details[$counter][0]	=	$id;
						$details[$counter][1]	=	$company_name;
						$details[$counter][2]	=	$full_name;
						$details[$counter][3]	=	$phone_number;
						$details[$counter][4]	=	$whatsapp_number;
						$details[$counter][5]	=	$email_address;
						$details[$counter][6]	=	$referred_by;	
						$details[$counter][7]	=	$country;
						$details[$counter][8]	=	$state;
						$details[$counter][9]	=	$district;
						$details[$counter][10]	=	$city;
						$details[$counter][11]	=	$address;
						$details[$counter][12]	=	$pin_code;
						$details[$counter][13]	=	$status;
						$details[$counter][14]	=	$your_locailty;
						$details[$counter][15]	=	$nearest_airport;
						$details[$counter][16]	=	$primary_business;
						$details[$counter][17]	=	$monthly_busines;
						$details[$counter][18]	=	$secondary_business;
						$details[$counter][19]	=	$monthly_business;
						$details[$counter][20]	=	$pan_no;
						$details[$counter][21]	=	$company_gst_no;
						$details[$counter][22]	=	$online_ota_1;
						$details[$counter][23]	=	$online_ota_2;
						$details[$counter][24]	=	$series_ota_1;
						$details[$counter][25]	=	$series_ota_2;
						$details[$counter][26]	=	$password;
						$details[$counter][27]	=	$date;
						$details[$counter][28]	=	$time;
						$details[$counter][29]	=	$wallet_balance;						
					
						$counter++;
					}
					if(!empty($details))	
					{
						return $details;
					}
					return false;
				}	
			}
		}
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
		


	function get_password_from_phone_number($phone_number)
		{
			if($stmt_select = $this->con->prepare("Select `password` from `register` where `phone_number` = ? "))
			{
				$stmt_select->bind_param("s",$phone_number);
			
				$stmt_select->bind_result($result_password);
			
				if($stmt_select->execute())
				{
					if($stmt_select->fetch())
					{
						return $result_password;
					}
				}
				return false;
			}
		}

 function get_password_user_phone_number($phone_number)
		 {
			 if($stmt_select = $this->con->prepare("Select `password` from `register` where `phone_number` = ? "))
			 {	
				 $stmt_select->bind_param("s",$phone_number);
			 
				 $stmt_select->bind_result($result_password);
			 
				 if($stmt_select->execute())
				 {
					 if($stmt_select->fetch())
					 {
						 return $result_password;
					 }
				 }
						 return false;
			 }
		 }
/*function change_password($phone_number,$newpassword)
			{ 
				$date = date("Y-m-d");
				$time = date("H:i:s A");
			echo 11111;
				if($stmt_select = $this->con->prepare("UPDATE `register` SET `password`=? WHERE `phone_number`=?"))
				{
					echo 222222;
					$stmt_select->bind_param("ss",$newpassword,$phone_number);				
				
					if($stmt_select->execute())
					{			
							echo 3333;	
						return true;
					}
						return false;
				}
			}*/
			
			
		function get_phone_number_from_user_empcode($phone_number)
		{
			if($stmt_select = $this->con->prepare("Select `phone_number` from `register` where `phone_number` = ? "))
			{
				$stmt_select->bind_param("s",$phone_number);
			
				$stmt_select->bind_result($result_phone_number);
			
				if($stmt_select->execute())
				{
					if($stmt_select->fetch())
					{
						return $result_phone_number;
					}
				}
				return false;
			}
		}
		
		
		function add_group_request($sector_on_woard,$travel_date,$no_of_pax,$expected_fare,$note,$agent_id,$status,$other_1,$other_2,$other_3)
		
		{
			$date = date("Y-m-d");
			$time = date("H-i-s A");
			
			if($stmt_insert = $this->con->prepare("INSERT INTO `group_request`( `sector_on_woard`, `travel_date`, `no_of_pax`, `expected_fare`, `note`, `agent_id`, `status`, `other_1`, `other_2`, `other_3`, `date`, `time`) VALUES (?,?,?,?,?,?,?,?,?,?,?,?)"))
			{
				$stmt_insert->bind_param("ssssssssssss",$sector_on_woard,$travel_date,$no_of_pax,$expected_fare,$note,$agent_id,$status,$other_1,$other_2,$other_3,$date,$time);
				
				if($stmt_insert->execute())
				{
					return true;
				}
					return false;
			} 	
		}
		
		function delete_group_request($delete_id)
		{
			if($stmt_select = $this->con->prepare("DELETE FROM `group_request` WHERE `id`=?"))
			{
				$stmt_select->bind_param("i",$delete_id);
			
				if($stmt_select->execute())
				{					
						return true;
				}
					return false;
			}
		}
		
		
		function get_all_group_request_for_search($pfrom_date,$pto_date,$travel_date,$no_of_pax,$expected_fare)
		
		{
			$travel_date_stmt = "";

			if($travel_date!="")
			{
				$travel_date_stmt = " AND `travel_date` LIKE '%".$travel_date."%'";
			}
			$stmt_no_of_pax = "";   

		    if($no_of_pax!="")
		    {
		        $stmt_no_of_pax = " AND `no_of_pax` LIKE '%".$no_of_pax."%'";
		    }

			$stmt_expected_fare = "";

			if($expected_fare!="")
			{
				$stmt_expected_fare = " AND `expected_fare` LIKE '%".$expected_fare."%'";
			}
			
			if($stmt_insert = $this->con->prepare("SELECT `id`, `sector_on_woard`, `travel_date`, `no_of_pax`, `expected_fare`, `note`, `agent_id`, `status`, `other_1`, `other_2`, `other_3`, `date`, `time` FROM `group_request` WHERE `status` IN ('Active', 'Block') AND (`date` between ? AND ?) ".$travel_date_stmt .$stmt_no_of_pax .$stmt_expected_fare))
			{	
				$stmt_insert->bind_param("ss",$pfrom_date,$pto_date);
				$stmt_insert->bind_result($id,$sector_on_woard,$travel_date,$no_of_pax,$expected_fare,$note,$agent_id,$status,$other_1,$other_2,$other_3,$date,$time);
				
				if($stmt_insert->execute())
				{
					$counter	=	0;
					$details	=	array();
					while($stmt_insert->fetch())
					{
						
						$details[$counter][0]	=	$id;
						$details[$counter][1]	=	$sector_on_woard;
						$details[$counter][2]	=	$travel_date;
						$details[$counter][3]	=	$no_of_pax;
						$details[$counter][4]	=	$expected_fare;
						$details[$counter][5]	=	$note;	
						$details[$counter][6]	=	$agent_id;
						$details[$counter][7]	=	$status;
						$details[$counter][8]	=	$other_1;
						$details[$counter][9]	=	$other_2;
						$details[$counter][10]	=	$other_3;
						$details[$counter][11]	=	$date;
						$details[$counter][12]	=	$time;	

					
						$counter++;
					}
					if(!empty($details))	
					{
						return $details;
					}
					return false;
				}	
			}
		}
		
		function get_all_group_request_for_agent($current_login_admin)
		
		{
			if($stmt_insert = $this->con->prepare("SELECT `id`, `sector_on_woard`, `travel_date`, `no_of_pax`, `expected_fare`, `note`, `agent_id`, `status`, `other_1`, `other_2`, `other_3`, `date`, `time` FROM `group_request` WHERE `status` = 'Pending' AND `agent_id`= ?"))
				{
				$stmt_insert->bind_param("s",$current_login_admin);
				$stmt_insert->bind_result($id,$sector_on_woard,$travel_date,$no_of_pax,$expected_fare,$note,$agent_id,$status,$other_1,$other_2,$other_3,$date,$time);
				
				if($stmt_insert->execute())
				{
					$counter	=	0;
					$details	=	array();
					while($stmt_insert->fetch())
					{
						
						$details[$counter][0]	=	$id;
						$details[$counter][1]	=	$sector_on_woard;
						$details[$counter][2]	=	$travel_date;
						$details[$counter][3]	=	$no_of_pax;
						$details[$counter][4]	=	$expected_fare;
						$details[$counter][5]	=	$note;	
						$details[$counter][6]	=	$agent_id;
						$details[$counter][7]	=	$status;
						$details[$counter][8]	=	$other_1;
						$details[$counter][9]	=	$other_2;
						$details[$counter][10]	=	$other_3;
						$details[$counter][11]	=	$date;
						$details[$counter][12]	=	$time;	

					
						$counter++;
					}
					if(!empty($details))	
					{
						return $details;
					}
					return false;
				}	
			}
		}
		function get_all_group_request_for_agent_for_search($current_login_admin,$gpfrom_date,$gpto_date,$gtravel_date,$gno_of_pax,$gexpected_fare)
		
		{
			$atravel_date_stmt = "";

			if($gtravel_date!="")
			{
				$atravel_date_stmt = " AND `travel_date` LIKE '%".$gtravel_date."%'";
			}
			$astmt_no_of_pax = "";   

		    if($gno_of_pax!="")
		    {
		        $astmt_no_of_pax = " AND `no_of_pax` LIKE '%".$gno_of_pax."%'";
		    }

			$astmt_expected_fare = "";

			if($gexpected_fare!="")
			{
				$astmt_expected_fare = " AND `expected_fare` LIKE '%".$gexpected_fare."%'";
			}

			
			if($stmt_insert = $this->con->prepare("SELECT `id`, `sector_on_woard`, `travel_date`, `no_of_pax`, `expected_fare`, `note`, `agent_id`, `status`, `other_1`, `other_2`, `other_3`, `date`, `time` FROM `group_request` WHERE `status` = 'Pending' AND `agent_id`= ? AND (`date` between ? AND  ? )".$atravel_date_stmt .$astmt_no_of_pax .$astmt_expected_fare))
				{
				$stmt_insert->bind_param("sss",$current_login_admin,$gpfrom_date,$gpto_date);
				$stmt_insert->bind_result($id,$sector_on_woard,$travel_date,$no_of_pax,$expected_fare,$note,$agent_id,$status,$other_1,$other_2,$other_3,$date,$time);
				
				if($stmt_insert->execute())
				{
					$counter	=	0;
					$details	=	array();
					while($stmt_insert->fetch())
					{
						
						$details[$counter][0]	=	$id;
						$details[$counter][1]	=	$sector_on_woard;
						$details[$counter][2]	=	$travel_date;
						$details[$counter][3]	=	$no_of_pax;
						$details[$counter][4]	=	$expected_fare;
						$details[$counter][5]	=	$note;	
						$details[$counter][6]	=	$agent_id;
						$details[$counter][7]	=	$status;
						$details[$counter][8]	=	$other_1;
						$details[$counter][9]	=	$other_2;
						$details[$counter][10]	=	$other_3;
						$details[$counter][11]	=	$date;
						$details[$counter][12]	=	$time;	

					
						$counter++;
					}
					if(!empty($details))	
					{
						return $details;
					}
					return false;
				}	
			}
		}
		function get_all_group_request_for_agent_aproved($current_login_admin)
		
		{
			if($stmt_insert = $this->con->prepare("SELECT `id`, `sector_on_woard`, `travel_date`, `no_of_pax`, `expected_fare`, `note`, `agent_id`, `status`, `other_1`, `other_2`, `other_3`, `date`, `time` FROM `group_request` WHERE `status` = 'Active' AND `agent_id`= ? "))
				{
				$stmt_insert->bind_param("s",$current_login_admin);
				$stmt_insert->bind_result($id,$sector_on_woard,$travel_date,$no_of_pax,$expected_fare,$note,$agent_id,$status,$other_1,$other_2,$other_3,$date,$time);
				
				if($stmt_insert->execute())
				{
					$counter	=	0;
					$details	=	array();
					while($stmt_insert->fetch())
					{
						
						$details[$counter][0]	=	$id;
						$details[$counter][1]	=	$sector_on_woard;
						$details[$counter][2]	=	$travel_date;
						$details[$counter][3]	=	$no_of_pax;
						$details[$counter][4]	=	$expected_fare;
						$details[$counter][5]	=	$note;	
						$details[$counter][6]	=	$agent_id;
						$details[$counter][7]	=	$status;
						$details[$counter][8]	=	$other_1;
						$details[$counter][9]	=	$other_2;
						$details[$counter][10]	=	$other_3;
						$details[$counter][11]	=	$date;
						$details[$counter][12]	=	$time;	

					
						$counter++;
					}
					if(!empty($details))	
					{
						return $details;
					}
					return false;
				}	
			}
		}
		
			function get_all_group_request_for_agent_aproved_for_search($current_login_admin,$agfrom_date,$agto_date,$agtravel_date,$agno_of_pax,$agexpected_fare)
		
		{
			$atravel_date_stmt = "";

			if($agtravel_date!="")
			{
				$atravel_date_stmt = " AND `travel_date` LIKE '%".$agtravel_date."%'";
			}
			$astmt_no_of_pax = "";   

		    if($agno_of_pax!="")
		    {
		        $astmt_no_of_pax = " AND `no_of_pax` LIKE '%".$agno_of_pax."%'";
		    }

			$astmt_expected_fare = "";

			if($agexpected_fare!="")
			{
				$astmt_expected_fare = " AND `expected_fare` LIKE '%".$agexpected_fare."%'";
			}
			if($stmt_insert = $this->con->prepare("SELECT `id`, `sector_on_woard`, `travel_date`, `no_of_pax`, `expected_fare`, `note`, `agent_id`, `status`, `other_1`, `other_2`, `other_3`, `date`, `time` FROM `group_request` WHERE `status` = 'Active' AND `agent_id`= ? AND (`date` between ? AND  ? )".$atravel_date_stmt .$astmt_no_of_pax .$astmt_expected_fare))
				{
				$stmt_insert->bind_param("sss",$current_login_admin,$agfrom_date,$agto_date);
				$stmt_insert->bind_result($id,$sector_on_woard,$travel_date,$no_of_pax,$expected_fare,$note,$agent_id,$status,$other_1,$other_2,$other_3,$date,$time);
				
				if($stmt_insert->execute())
				{
					$counter	=	0;
					$details	=	array();
					while($stmt_insert->fetch())
					{
						
						$details[$counter][0]	=	$id;
						$details[$counter][1]	=	$sector_on_woard;
						$details[$counter][2]	=	$travel_date;
						$details[$counter][3]	=	$no_of_pax;
						$details[$counter][4]	=	$expected_fare;
						$details[$counter][5]	=	$note;	
						$details[$counter][6]	=	$agent_id;
						$details[$counter][7]	=	$status;
						$details[$counter][8]	=	$other_1;
						$details[$counter][9]	=	$other_2;
						$details[$counter][10]	=	$other_3;
						$details[$counter][11]	=	$date;
						$details[$counter][12]	=	$time;	

					
						$counter++;
					}
					if(!empty($details))	
					{
						return $details;
					}
					return false;
				}	
			}
		}
		
		
		function get_all_group_request_pending()
		
		{
			if($stmt_insert = $this->con->prepare("SELECT `id`, `sector_on_woard`, `travel_date`, `no_of_pax`, `expected_fare`, `note`, `agent_id`, `status`, `other_1`, `other_2`, `other_3`, `date`, `time` FROM `group_request` where `status`='Pending'"))
			{	
				$stmt_insert->bind_result($id,$sector_on_woard,$travel_date,$no_of_pax,$expected_fare,$note,$agent_id,$status,$other_1,$other_2,$other_3,$date,$time);
				
				if($stmt_insert->execute())
				{
					$counter	=	0;
					$details	=	array();
					while($stmt_insert->fetch())
					{
						
						$details[$counter][0]	=	$id;
						$details[$counter][1]	=	$sector_on_woard;
						$details[$counter][2]	=	$travel_date;
						$details[$counter][3]	=	$no_of_pax;
						$details[$counter][4]	=	$expected_fare;
						$details[$counter][5]	=	$note;	
						$details[$counter][6]	=	$agent_id;
						$details[$counter][7]	=	$status;
						$details[$counter][8]	=	$other_1;
						$details[$counter][9]	=	$other_2;
						$details[$counter][10]	=	$other_3;
						$details[$counter][11]	=	$date;
						$details[$counter][12]	=	$time;					
					
						$counter++;
					}
					if(!empty($details))	
					{
						return $details;
					}
					return false;
				}	
			}
		}
		


		function get_all_group_request_pending_for_search($afrom_date,$ato_date,$atravel_date,$ano_of_pax,$aexpected_fare)
		{
			$atravel_date_stmt = "";

			if($atravel_date!="")
			{
				$atravel_date_stmt = " AND `travel_date` LIKE '%".$atravel_date."%'";
			}
			$astmt_no_of_pax = "";   

		    if($ano_of_pax!="")
		    {
		        $astmt_no_of_pax = " AND `no_of_pax` LIKE '%".$ano_of_pax."%'";
		    }

			$astmt_expected_fare = "";

			if($aexpected_fare!="")
			{
				$astmt_expected_fare = " AND `expected_fare` LIKE '%".$aexpected_fare."%'";
			}
			

			if($stmt_insert = $this->con->prepare("SELECT `id`, `sector_on_woard`, `travel_date`, `no_of_pax`, `expected_fare`, `note`, `agent_id`, `status`, `other_1`, `other_2`, `other_3`, `date`, `time` FROM `group_request` where `status`='Pending' AND (`date` between ? AND ?) ".$atravel_date_stmt .$astmt_no_of_pax .$astmt_expected_fare))
			{	

				$stmt_insert->bind_param("ss",$afrom_date,$ato_date);
				$stmt_insert->bind_result($id,$sector_on_woard,$travel_date,$no_of_pax,$expected_fare,$note,$agent_id,$status,$other_1,$other_2,$other_3,$date,$time);
				
				if($stmt_insert->execute())
				{
					$counter	=	0;
					$details	=	array();
					while($stmt_insert->fetch())
					{
						
						$details[$counter][0]	=	$id;
						$details[$counter][1]	=	$sector_on_woard;
						$details[$counter][2]	=	$travel_date;
						$details[$counter][3]	=	$no_of_pax;
						$details[$counter][4]	=	$expected_fare;
						$details[$counter][5]	=	$note;	
						$details[$counter][6]	=	$agent_id;
						$details[$counter][7]	=	$status;
						$details[$counter][8]	=	$other_1;
						$details[$counter][9]	=	$other_2;
						$details[$counter][10]	=	$other_3;
						$details[$counter][11]	=	$date;
						$details[$counter][12]	=	$time;					
					
						$counter++;
					}
					if(!empty($details))	
					{
						return $details;
					}
					return false;
				}	
			}
		}
		
		function update_pending_group_request($sector_on_woard,$travel_date,$no_of_pax,$expected_fare,$note,$other_1,$other_2,$other_3,$res_edit_id)
		{
			$date = date("Y-m-d");
			$time = date("H-i-s A");

			if ($stmt_insert = $this->con->prepare("UPDATE `group_request` SET `sector_on_woard`=?,`travel_date`=?,`no_of_pax`=?,`expected_fare`=?,`note`=?,`other_1`=?,`other_2`=?,`other_3`=?,`date`=?,`time`=? WHERE `id`=?")) 
			{
				$stmt_insert->bind_param("ssssssssssi",$sector_on_woard,$travel_date,$no_of_pax,$expected_fare,$note,$other_1,$other_2,$other_3,$date, $time, $res_edit_id);
				
				if ($stmt_insert->execute()) 
				{
					return true;
				} 
				else 
				{
					return false;
				}
			} 
		}
		
		
		
		function get_pending_group_request_from_id($res_edit_id)
		{ 
        if($stmt = $this->con->prepare("SELECT `id`, `sector_on_woard`, `travel_date`, `no_of_pax`, `expected_fare`, `note`, `agent_id`, `status`, `other_1`, `other_2`, `other_3`, `date`, `time` FROM `group_request` WHERE `id`=?"))
		{ 
            $stmt->bind_param("i",$res_edit_id);
            $stmt->bind_result($id,$sector_on_woard,$travel_date,$no_of_pax,$expected_fare,$note,$agent_id,$status,$other_1,$other_2,$other_3,$date,$time);
				
			if($stmt->execute())
			{ 
				$users_data = array();
				$counter = 0;
			} 
			while($stmt->fetch())
			{ 
           		$users_data['id']             			= $id;								
				$users_data['sector_on_woard']      	= $sector_on_woard;					
				$users_data['travel_date']             	= $travel_date;	
	            $users_data['no_of_pax']                = $no_of_pax;					
				$users_data['expected_fare']        	= $expected_fare;						
				$users_data['note']         			= $note;					
				$users_data['agent_id']            		= $agent_id;				
				$users_data['status']             		= $status;
				$users_data['other_1']           		= $other_1;							
				$users_data['other_2']           		= $other_2;	
                $users_data['other_3']            		= $other_3;								
				$users_data['date']                 	= $date;							
				$users_data['time']                 	= $time;						
			}
                if(!empty($users_data))
				{
                    return $users_data;
                }
                else
				{
                    return false;
                }
        }
    }
	
function set_status_active($id,$status) {
        if ($stmt = $this->con->prepare("UPDATE group_request SET status = '$status' WHERE id = ?")) 
		{
            $stmt->bind_param('i', $id);

            if ($stmt->execute()) {
                $stmt->close();
                return true;
            } else {
                $stmt->close();
                return false;
            }
        }

        return false;
    }
	function set_status_active_recharge($id,$status) {
        if ($stmt = $this->con->prepare("UPDATE upload_request SET status = '$status' WHERE id = ?")) 
		{
            $stmt->bind_param('i', $id);

            if ($stmt->execute()) {
                $stmt->close();
                return true;
            } else {
                $stmt->close();
                return false;
            }
        }

        return false;
    }
	function get_all_group_request_block()
		
		{
			if($stmt_insert = $this->con->prepare("SELECT `id`, `sector_on_woard`, `travel_date`, `no_of_pax`, `expected_fare`, `note`, `agent_id`, `status`, `other_1`, `other_2`, `other_3`, `date`, `time` FROM `group_request` where `status`='Block'"))
			{	
				$stmt_insert->bind_result($id,$sector_on_woard,$travel_date,$no_of_pax,$expected_fare,$note,$agent_id,$status,$other_1,$other_2,$other_3,$date,$time);
				
				if($stmt_insert->execute())
				{
					$counter	=	0;
					$details	=	array();
					while($stmt_insert->fetch())
					{
						
						$details[$counter][0]	=	$id;
						$details[$counter][1]	=	$sector_on_woard;
						$details[$counter][2]	=	$travel_date;
						$details[$counter][3]	=	$no_of_pax;
						$details[$counter][4]	=	$expected_fare;
						$details[$counter][5]	=	$note;	
						$details[$counter][6]	=	$agent_id;
						$details[$counter][7]	=	$status;
						$details[$counter][8]	=	$other_1;
						$details[$counter][9]	=	$other_2;
						$details[$counter][10]	=	$other_3;
						$details[$counter][11]	=	$date;
						$details[$counter][12]	=	$time;					
					
						$counter++;
					}
					if(!empty($details))	
					{
						return $details;
					}
					return false;
				}	
			}
		}
		
		
		
		
		//upload request
		
		
		 function insert_upload_request($agent_id,$amount,$reference_no,$payment_method,$photo,$message,$status)
		{
			$date = date("Y-m-d");
			$time = date("H-i-s A");
			
			if($stmt_insert = $this->con->prepare("INSERT INTO `upload_request`( `agent_id`, `amount`, `reference_no`, `payment_method`, `photo`, `message`, `status`, `date`, `time`) VALUES  (?,?,?,?,?,?,?,?,?)"))
			{
				$stmt_insert->bind_param("sssssssss",$agent_id,$amount,$reference_no,$payment_method,$photo,$message,$status,$date,$time);
				
				if($stmt_insert->execute())
				{
					return true;
				}
					return false;
			} 	
		}

		
		//  function insert_upload_request_for_temp_credit($agent_id,$payment_method,$photo,$message,$status,$amount,$admin_id)
		// {
		// 	$date = date("Y-m-d");
		// 	$time = date("H-i-s A");

		// 	if($stmt_insert = $this->con->prepare("INSERT INTO `upload_request`( `agent_id`, `payment_method`, `photo`, `message`,`status`, `date`, `time`,`temp_credit`,`admin_id`) VALUES  (?,?,?,?,?,?,?,?,?)"))
		// 	{
		// 		$stmt_insert->bind_param("sssssssss",$agent_id,$payment_method,$photo,$message,$status,$date,$time,$amount,$admin_id);
				
		// 		if($stmt_insert->execute())
		// 		{
		// 			return true;
		// 		}
		// 			return false;
		// 	} 	
		// }
		
		function insert_upload_request_for_temp_credit($agent_id, $payment_method, $photo, $message, $status, $amount, $admin_id)
{
    $date = date("Y-m-d");
    $time = date("H:i:s A");

    $sql = "INSERT INTO `upload_request` (`agent_id`, `payment_method`, `photo`, `message`, `status`, `date`, `time`, `temp_credit`, `admin_id`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)";
    
    if ($stmt_insert = $this->con->prepare($sql)) {
        $stmt_insert->bind_param("sssssssss", $agent_id, $payment_method, $photo, $message, $status, $date, $time, $amount, $admin_id);
        
        if ($stmt_insert->execute()) {
            return true;
        } else {
            // Debugging: print the error message
            echo "Execute failed: (" . $stmt_insert->errno . ") " . $stmt_insert->error;
            return false;
        }
    } else {
        // Debugging: print the error message
        echo "Prepare failed: (" . $this->con->errno . ") " . $this->con->error;
        return false;
    }
}

		function delete_upload_request($delete_id)
		{
			if($stmt_select = $this->con->prepare("DELETE FROM `upload_request` WHERE `id`=?"))
			{
				$stmt_select->bind_param("i",$delete_id);
			
				if($stmt_select->execute())
				{					
						return true;
				}
					return false;
			}
		}
		
		
		function set_request_status_active($id,$status) 
		{
        if ($stmt = $this->con->prepare("UPDATE upload_request SET status = '$status' WHERE id = ?")) {
            $stmt->bind_param('i', $id);

            if ($stmt->execute()) {
                $stmt->close();
                return true;
            } else {
                $stmt->close();
                return false;
            }
        }

        return false;
    }
	
	
		function set_request_status_block($id,$status) 
		{
        if ($stmt = $this->con->prepare("UPDATE upload_request SET status = '$status' WHERE id = ?")) {
            $stmt->bind_param('i', $id);

            if ($stmt->execute()) {
                $stmt->close();
                return true;
            } else {
                $stmt->close();
                return false;
            }
        }

        return false;
    }
	
	
	
	 function get_upload_request_block()
		{ 
if($stmt = $this->con->prepare("SELECT `id`,`agent_id`,`amount`,`reference_no`,`payment_method`,`photo`,`message`,`status`,`date`, `time` FROM `upload_request` WHERE `status` = 'block'"))
			{
				$stmt->bind_result($id,$agent_id,$amount,$reference_no,$payment_method,$photo,$message,$status,$date,$time);
				
				if($stmt->execute())
				{
					$details	=	array();
					$counter	=	0;
					
					while($stmt->fetch())
					{
						$details[$counter][0]	=	$id;
						$details[$counter][1]	=	$agent_id;
						$details[$counter][2]	=	$amount;
						$details[$counter][3]	=	$reference_no;
						$details[$counter][4]	=	$payment_method;
						$details[$counter][5]	=	$photo;
						$details[$counter][6]	=	$message;
						$details[$counter][7]	=	$status;
						$details[$counter][8]	=	$date;
						$details[$counter][9]	=	$time;
					 	
					   	$counter++;
					}
					if(!empty($details))
					{
						return $details;
					
					}
					else
					{
						return false;
					}
				}
			}
		}
		
		
		
		function get_all_upload_request()
		{
			
			if($stmt_insert = $this->con->prepare("SELECT `id`, `agent_id`, `amount`, `reference_no`, `payment_method`, `photo`, `message`, `status`, `date`, `time` FROM `upload_request` WHERE `status` IN ('Active','Block')"))
				
		$stmt_insert->bind_result($id,$agent_id,$amount,$reference_no,$payment_method,$photo,$message,$status,$date,$time);
				
				if($stmt_insert->execute())
				{
					$counter	=	0;
					$details	=	array();
					while($stmt_insert->fetch())
					{
						$details[$counter][0]	=	$id;
						$details[$counter][1]	=	$agent_id;
						$details[$counter][2]	=	$amount;
						$details[$counter][3]	=	$reference_no;
						$details[$counter][4]	=	$payment_method;
						$details[$counter][5]	=	$photo;
						$details[$counter][6]	=	$message;
						$details[$counter][7]	=	$status;
						$details[$counter][8]	=	$date;
						$details[$counter][9]	=	$time;
					
					
						$counter++;
					}
					if(!empty($details))	
					{
						return $details;
					}
					return false;
				}	
			}

		function get_all_upload_request_for_search($ufrom_date,$uto_date,$uamount,$upay)
		{
			
				$stmt_amount_u = "";   

		    if($uamount!="")
		    {
		        $stmt_amount_u = " AND `amount` LIKE '%".$uamount."%'";
		    }
		   $stmt_pay = "";

			if ($upay!="" && $upay != "Select")
			{
				$stmt_pay = " AND `payment_method`= '".$upay."'";
			}

			if($stmt_insert = $this->con->prepare("SELECT `id`, `agent_id`, `amount`, `reference_no`, `payment_method`, `photo`, `message`, `status`, `date`, `time` FROM `upload_request` WHERE `status` IN ('Active','Block') AND (`date` between ?  AND ?)" .$stmt_amount_u .$stmt_pay))
				
				$stmt_insert->bind_param("ss",$ufrom_date,$uto_date);
		$stmt_insert->bind_result($id,$agent_id,$amount,$reference_no,$payment_method,$photo,$message,$status,$date,$time);
				
				if($stmt_insert->execute())
				{
					$counter	=	0;
					$details	=	array();
					while($stmt_insert->fetch())
					{
						$details[$counter][0]	=	$id;
						$details[$counter][1]	=	$agent_id;
						$details[$counter][2]	=	$amount;
						$details[$counter][3]	=	$reference_no;
						$details[$counter][4]	=	$payment_method;
						$details[$counter][5]	=	$photo;
						$details[$counter][6]	=	$message;
						$details[$counter][7]	=	$status;
						$details[$counter][8]	=	$date;
						$details[$counter][9]	=	$time;
					
					
						$counter++;
					}
					if(!empty($details))	
					{
						return $details;
					}
					return false;
				}	
			}
	function get_all_upload_request_for_sales($res_edit_id)
		{
		    if ($stmt_insert = $this->con->prepare("SELECT `id`, `agent_id`, `amount`, `reference_no`, `payment_method`, `photo`, `message`, `status`, `date`, `time` FROM `upload_request` WHERE `status` = 'Block' AND `agent_id` = ?")) {
		        
		        $stmt_insert->bind_param("s", $res_edit_id);
		                
		        $stmt_insert->bind_result($id, $agent_id, $amount, $reference_no, $payment_method, $photo, $message, $status, $date, $time);
		                
		        if ($stmt_insert->execute()) {
		            $counter = 0;
		            $details = array();
		            while ($stmt_insert->fetch()) {
		                $details[$counter][0] = $id;
		                $details[$counter][1] = $agent_id;
		                $details[$counter][2] = $amount;
		                $details[$counter][3] = $reference_no;
		                $details[$counter][4] = $payment_method;
		                $details[$counter][5] = $photo;
		                $details[$counter][6] = $message;
		                $details[$counter][7] = $status;
		                $details[$counter][8] = $date;
		                $details[$counter][9] = $time;
		                
		                $counter++;
		            }
		            if (!empty($details)) {
		                return $details;
		            }
		            return false;
		        } else {
		            echo "Execution failed: " . $stmt_insert->error;
		        }
		    } else {
		        echo "Prepare failed: " . $this->con->error;
		    }
		}

		
function get_all_upload_request_for_sales_for_pending($res_edit_id)
		{
		    if ($stmt_insert = $this->con->prepare("SELECT `id`, `agent_id`, `amount`, `reference_no`, `payment_method`, `photo`, `message`, `status`, `date`, `time` FROM `upload_request` WHERE `status` = 'Pending' AND `agent_id` = ?")) {
		        
		        $stmt_insert->bind_param("s", $res_edit_id);
		                
		        $stmt_insert->bind_result($id, $agent_id, $amount, $reference_no, $payment_method, $photo, $message, $status, $date, $time);
		                
		        if ($stmt_insert->execute()) {
		            $counter = 0;
		            $details = array();
		            while ($stmt_insert->fetch()) {
		                $details[$counter][0] = $id;
		                $details[$counter][1] = $agent_id;
		                $details[$counter][2] = $amount;
		                $details[$counter][3] = $reference_no;
		                $details[$counter][4] = $payment_method;
		                $details[$counter][5] = $photo;
		                $details[$counter][6] = $message;
		                $details[$counter][7] = $status;
		                $details[$counter][8] = $date;
		                $details[$counter][9] = $time;
		                
		                $counter++;
		            }
		            if (!empty($details)) {
		                return $details;
		            }
		            return false;
		        } else {
		            echo "Execution failed: " . $stmt_insert->error;
		        }
		    } else {
		        echo "Prepare failed: " . $this->con->error;
		    }
		}

		function get_all_upload_request_for_sales_for_complete($res_edit_id)
		{
		    if ($stmt_insert = $this->con->prepare("SELECT `id`, `agent_id`, `amount`, `reference_no`, `payment_method`, `photo`, `message`, `status`, `date`, `time` FROM `upload_request` WHERE `status` = 'Active' AND `agent_id` = ?")) {
		        
		        $stmt_insert->bind_param("s", $res_edit_id);
		                
		        $stmt_insert->bind_result($id, $agent_id, $amount, $reference_no, $payment_method, $photo, $message, $status, $date, $time);
		                
		        if ($stmt_insert->execute()) {
		            $counter = 0;
		            $details = array();
		            while ($stmt_insert->fetch()) {
		                $details[$counter][0] = $id;
		                $details[$counter][1] = $agent_id;
		                $details[$counter][2] = $amount;
		                $details[$counter][3] = $reference_no;
		                $details[$counter][4] = $payment_method;
		                $details[$counter][5] = $photo;
		                $details[$counter][6] = $message;
		                $details[$counter][7] = $status;
		                $details[$counter][8] = $date;
		                $details[$counter][9] = $time;
		                
		                $counter++;
		            }
		            if (!empty($details)) {
		                return $details;
		            }
		            return false;
		        } else {
		            echo "Execution failed: " . $stmt_insert->error;
		        }
		    } else {
		        echo "Prepare failed: " . $this->con->error;
		    }
		}




		function get_all_upload_request_for_agent($current_login_admin)
		{
			
			if($stmt_insert = $this->con->prepare("SELECT `id`, `agent_id`, `amount`, `reference_no`, `payment_method`, `photo`, `message`, `status`, `date`, `time` FROM `upload_request` WHERE `status` = 'Pending'  AND  `agent_id`=?"))
				
				{
					$stmt_insert->bind_param("s",$current_login_admin);
		$stmt_insert->bind_result($id,$agent_id,$amount,$reference_no,$payment_method,$photo,$message,$status,$date,$time);
				
				if($stmt_insert->execute())
				{
					$counter	=	0;
					$details	=	array();
					while($stmt_insert->fetch())
					{
						$details[$counter][0]	=	$id;
						$details[$counter][1]	=	$agent_id;
						$details[$counter][2]	=	$amount;
						$details[$counter][3]	=	$reference_no;
						$details[$counter][4]	=	$payment_method;
						$details[$counter][5]	=	$photo;
						$details[$counter][6]	=	$message;
						$details[$counter][7]	=	$status;
						$details[$counter][8]	=	$date;
						$details[$counter][9]	=	$time;
					
					
						$counter++;
					}
					if(!empty($details))	
					{
						return $details;
					}
					return false;
				}	
			}
			}
			
			function get_all_upload_request_for_agent_for_search($current_login_admin,$rrfrom_date,$rrto_date,$rrno_of_pax,$rrexpected_fare)
		{
			
			$stmt_no_of_pax = "";   

		    if($rrno_of_pax!="")
		    {
		        $stmt_no_of_pax = " AND `amount` LIKE '%".$rrno_of_pax."%'";
		    }
		    $stmt_expected_fare = "";

			if ($rrexpected_fare!="" && $rrexpected_fare != "Select")
			{
				$stmt_expected_fare = " AND `payment_method`= '".$rrexpected_fare."'";
			}

			if($stmt_insert = $this->con->prepare("SELECT `id`, `agent_id`, `amount`, `reference_no`, `payment_method`, `photo`, `message`, `status`, `date`, `time` FROM `upload_request` WHERE `status` = 'Pending'  AND  `agent_id`=? AND (`date` between ? AND ?) " .$stmt_no_of_pax .$stmt_expected_fare))
				
				{
					$stmt_insert->bind_param("sss",$current_login_admin,$rrfrom_date,$rrto_date);
		$stmt_insert->bind_result($id,$agent_id,$amount,$reference_no,$payment_method,$photo,$message,$status,$date,$time);
				
				if($stmt_insert->execute())
				{
					$counter	=	0;
					$details	=	array();
					while($stmt_insert->fetch())
					{
						$details[$counter][0]	=	$id;
						$details[$counter][1]	=	$agent_id;
						$details[$counter][2]	=	$amount;
						$details[$counter][3]	=	$reference_no;
						$details[$counter][4]	=	$payment_method;
						$details[$counter][5]	=	$photo;
						$details[$counter][6]	=	$message;
						$details[$counter][7]	=	$status;
						$details[$counter][8]	=	$date;
						$details[$counter][9]	=	$time;
					
					
						$counter++;
					}
					if(!empty($details))	
					{
						return $details;
					}
					return false;
				}	
			}
			}

				function get_all_upload_request_for_agent_approved($current_login_admin)
		{
			
			if($stmt_insert = $this->con->prepare("SELECT `id`, `agent_id`, `amount`, `reference_no`, `payment_method`, `photo`, `message`, `status`, `date`, `time` FROM `upload_request` WHERE `status` = 'Active'  AND  `agent_id`=?"))
				
				{
					$stmt_insert->bind_param("s",$current_login_admin);
		$stmt_insert->bind_result($id,$agent_id,$amount,$reference_no,$payment_method,$photo,$message,$status,$date,$time);
				
				if($stmt_insert->execute())
				{
					$counter	=	0;
					$details	=	array();
					while($stmt_insert->fetch())
					{
						$details[$counter][0]	=	$id;
						$details[$counter][1]	=	$agent_id;
						$details[$counter][2]	=	$amount;
						$details[$counter][3]	=	$reference_no;
						$details[$counter][4]	=	$payment_method;
						$details[$counter][5]	=	$photo;
						$details[$counter][6]	=	$message;
						$details[$counter][7]	=	$status;
						$details[$counter][8]	=	$date;
						$details[$counter][9]	=	$time;
					
					
						$counter++;
					}
					if(!empty($details))	
					{
						return $details;
					}
					return false;
				}	
			}
			}
			
	function get_all_upload_request_for_agent_approved_for_search($current_login_admin,$arfrom_date,$arto_date,$arno_of_pax,$arexpected_fare)
		{
			$stmt_no_of_pax = "";   

		    if($arno_of_pax!="")
		    {
		        $stmt_no_of_pax = " AND `amount` LIKE '%".$arno_of_pax."%'";
		    }
		    $stmt_expected_fare = "";

			if ($arexpected_fare!="" && $arexpected_fare != "Select")
			{
				$stmt_expected_fare = " AND `payment_method`= '".$arexpected_fare."'";
			}
			
			if($stmt_insert = $this->con->prepare("SELECT `id`, `agent_id`, `amount`, `reference_no`, `payment_method`, `photo`, `message`, `status`, `date`, `time` FROM `upload_request` WHERE `status` = 'Active'  AND  `agent_id`=?  AND (`date` between ? AND ?) " .$stmt_no_of_pax .$stmt_expected_fare))
				
				{
					$stmt_insert->bind_param("sss",$current_login_admin,$arfrom_date,$arto_date);
		$stmt_insert->bind_result($id,$agent_id,$amount,$reference_no,$payment_method,$photo,$message,$status,$date,$time);
				
				if($stmt_insert->execute())
				{
					$counter	=	0;
					$details	=	array();
					while($stmt_insert->fetch())
					{
						$details[$counter][0]	=	$id;
						$details[$counter][1]	=	$agent_id;
						$details[$counter][2]	=	$amount;
						$details[$counter][3]	=	$reference_no;
						$details[$counter][4]	=	$payment_method;
						$details[$counter][5]	=	$photo;
						$details[$counter][6]	=	$message;
						$details[$counter][7]	=	$status;
						$details[$counter][8]	=	$date;
						$details[$counter][9]	=	$time;
					
					
						$counter++;
					}
					if(!empty($details))	
					{
						return $details;
					}
					return false;
				}	
			}
			}
			function update_upload_request( $amount, $reference_no, $payment_method, $message, $res_edit_id) {
    $date = date("Y-m-d");
    $time = date("H-i-s A");

    if ($stmt_insert = $this->con->prepare("UPDATE `upload_request` SET `amount`=?,`reference_no`=?,`payment_method`=?,`message`=?,`date`=?,`time`=? WHERE `id`=?")) {
        $stmt_insert->bind_param("ssssssi",  $amount, $reference_no, $payment_method, $message, $date, $time, $res_edit_id);
        
        if ($stmt_insert->execute()) {
            return true;
        } else {
            return false;
        }
    } else {
        return false;
    }
}
function get_upload_request_data_from_id($res_edit_id)
		{ 
        if($stmt = $this->con->prepare("SELECT `id`, `agent_id`, `amount`, `reference_no`, `payment_method`,  `message`,  `date`, `time` FROM `upload_request` WHERE `id`=?"))
		{
            $stmt->bind_param("i",$res_edit_id);
            $stmt->bind_result($id,$agent_id, $amount, $reference_no, $payment_method, $message,$date,$time);
				
			if($stmt->execute())
			{
				$users_data = array();
				$counter = 0;
			}
			while($stmt->fetch())
			{ 
            $users_data['id'] 							= $id;
			$users_data['agent_id'] 					= $agent_id;
			$users_data['amount'] 						= $amount;
			$users_data['reference_no'] 				= $reference_no;
			$users_data['payment_method']				= $payment_method;
			$users_data['message'] 						= $message;
			$users_data['date']							= $date;
			$users_data['time'] 						= $time;
            }
                if(!empty($users_data))
				{
                    return $users_data;
                }
                else
				{
                    return false;
                }
        }
    }
	
	
	function get_upload_request_pending()
		{ 
if($stmt = $this->con->prepare("SELECT `id`,`agent_id`,`amount`,`reference_no`,`payment_method`,`photo`,`message`,`status`,`date`, `time` FROM `upload_request` WHERE `status` = 'Pending'"))
			{
				$stmt->bind_result($id,$agent_id,$amount,$reference_no,$payment_method,$photo,$message,$status,$date,$time);
				
				if($stmt->execute())
				{
					$details	=	array();
					$counter	=	0;
					
					while($stmt->fetch())
					{
						$details[$counter][0]	=	$id;
						$details[$counter][1]	=	$agent_id;
						$details[$counter][2]	=	$amount;
						$details[$counter][3]	=	$reference_no;
						$details[$counter][4]	=	$payment_method;
						$details[$counter][5]	=	$photo;
						$details[$counter][6]	=	$message;
						$details[$counter][7]	=	$status;
						$details[$counter][8]	=	$date;
						$details[$counter][9]	=	$time;
					 	
					   	$counter++;
					}
					if(!empty($details))
					{
						return $details;
					
					}
					else
					{
						return false;
					}
				}
			}
		}

		function get_upload_request_pending_for_search($rfrom_date,$rto_date,$rno_of_pax,$rexpected_fare)
		{ 
			
			$stmt_no_of_pax = "";   

		    if($rno_of_pax!="")
		    {
		        $stmt_no_of_pax = " AND `amount` LIKE '%".$rno_of_pax."%'";
		    }
		    $stmt_expected_fare = "";

			if ($rexpected_fare!="" && $rexpected_fare != "Select")
			{
				$stmt_expected_fare = " AND `payment_method`= '".$rexpected_fare."'";
			}


			if($stmt = $this->con->prepare("SELECT `id`,`agent_id`,`amount`,`reference_no`,`payment_method`,`photo`,`message`,`status`,`date`, `time` FROM `upload_request` WHERE `status` = 'Pending'AND (`date` between ? AND ?) " .$stmt_no_of_pax .$stmt_expected_fare))
			{
				$stmt->bind_param("ss",$rfrom_date,$rto_date);
				$stmt->bind_result($id,$agent_id,$amount,$reference_no,$payment_method,$photo,$message,$status,$date,$time);
				
				if($stmt->execute())
				{
					$details	=	array();
					$counter	=	0;
					
					while($stmt->fetch())
					{
						$details[$counter][0]	=	$id;
						$details[$counter][1]	=	$agent_id;
						$details[$counter][2]	=	$amount;
						$details[$counter][3]	=	$reference_no;
						$details[$counter][4]	=	$payment_method;
						$details[$counter][5]	=	$photo;
						$details[$counter][6]	=	$message;
						$details[$counter][7]	=	$status;
						$details[$counter][8]	=	$date;
						$details[$counter][9]	=	$time;
					 	
					   	$counter++;
					}
					if(!empty($details))
					{
						return $details;
					
					}
					else
					{
						return false;
					}
				}
			}
		}
		
function get_upload_request_for_temp_credit($current_login_admin)
		{ 
		if($stmt = $this->con->prepare("SELECT `id`,`agent_id`,`amount`,`reference_no`,`payment_method`,`photo`,`message`,`status`,`date`, `time`,`temp_credit`,`admin_id` FROM `upload_request` WHERE `admin_id`=?"))
			{
				$stmt->bind_param("s",$current_login_admin);
				$stmt->bind_result($id,$agent_id,$amount,$reference_no,$payment_method,$photo,$message,$status,$date,$time,$temp_credit,$admin_id);
				
				if($stmt->execute())
				{
					$details	=	array();
					$counter	=	0;
					
					while($stmt->fetch())
					{
						$details[$counter][0]	=	$id;
						$details[$counter][1]	=	$agent_id;
						$details[$counter][2]	=	$amount;
						$details[$counter][3]	=	$reference_no;
						$details[$counter][4]	=	$payment_method;
						$details[$counter][5]	=	$photo;
						$details[$counter][6]	=	$message;
						$details[$counter][7]	=	$status;
						$details[$counter][8]	=	$date;
						$details[$counter][9]	=	$time;
						$details[$counter][10]	=	$temp_credit;
						$details[$counter][11]	=	$admin_id;
					 	
					   	$counter++;
					}
					if(!empty($details))
					{
						return $details;
					
					}
					else
					{
						return false;
					}
				}
			}
		}
		function get_upload_request_for_temp_credit_for_search($current_login_admin,$tfrom_date,$tto_date,$aamount,$message,$tpaymethod)
		{ 

		$stmt_amount = "";
    if ($aamount != "") {
        $stmt_amount = " AND `amount` LIKE '%" . $aamount . "%'";
    }

    $stmt_message = "";
    if ($message != "") {
        $stmt_message = " AND `message` LIKE '%" . $message . "%'";
    }

    $stmt_methos = "";
    if ($tpaymethod != "" && $tpaymethod != "Select") {
        $stmt_methos = " AND `payment_method`= '" . $tpaymethod . "'";
    }

		if($stmt = $this->con->prepare("SELECT `id`, `agent_id`, `amount`, `reference_no`, `payment_method`, `photo`, `message`, `status`, `date`, `time`, `temp_credit`, `admin_id` 
              FROM `upload_request` 
              WHERE `admin_id` = ? AND (`date` BETWEEN ? AND ?)" . $stmt_amount . $stmt_message . $stmt_methos))
			{
				$stmt->bind_param("sss",$current_login_admin,$tfrom_date,$tto_date);
				$stmt->bind_result($id,$agent_id,$amount,$reference_no,$payment_method,$photo,$message,$status,$date,$time,$temp_credit,$admin_id);
				
				if($stmt->execute())
				{
					$details	=	array();
					$counter	=	0;
					
					while($stmt->fetch())
					{
						$details[$counter][0]	=	$id;
						$details[$counter][1]	=	$agent_id;
						$details[$counter][2]	=	$amount;
						$details[$counter][3]	=	$reference_no;
						$details[$counter][4]	=	$payment_method;
						$details[$counter][5]	=	$photo;
						$details[$counter][6]	=	$message;
						$details[$counter][7]	=	$status;
						$details[$counter][8]	=	$date;
						$details[$counter][9]	=	$time;
						$details[$counter][10]	=	$temp_credit;
						$details[$counter][11]	=	$admin_id;
					 	
					   	$counter++;
					}
					if(!empty($details))
					{
						return $details;
					
					}
					else
					{
						return false;
					}
				}
			}
		}
// function add_flight_booking($transaction_id,$booking_type,$agent_id,$from_location,$to_location,$travel_date,$pax_size,$tour_code,$traveller_type,$salutation,$first_name,$last_name,$birth_dd,$birth_mm,$birth_year,$ticket_status,$ticket_amount,$total_amount,$commission,$other_1,$other_2,$other_3)
// {
// 	$date = date("Y-m-d");
// 	$time = date("H-i-s A");
	
// 	if($stmt_insert = $this->con->prepare("INSERT INTO `flight_booking`( `transaction_id`, `booking_type`, `agent_id`, `from_location`, `to_location`, `travel_date`, `pax_size`, `tour_code`, `traveller_type`, `salutation`, `first_name`, `last_name`, `birth_dd`, `birth_mm`, `birth_year`, `ticket_status`, `ticket_amount`, `total_amount`, `commission`, `other_1`, `other_2`, `other_3`, `date`, `time`) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"))
// 	{
// 		$stmt_insert->bind_param("ssssssssssssssssssssssss",$transaction_id,$booking_type,$agent_id,$from_location,$to_location,$travel_date,$pax_size,$tour_code,$traveller_type,$salutation,$first_name,$last_name,$birth_dd,$birth_mm,$birth_year,$ticket_status,$ticket_amount,$total_amount,$commission,$other_1,$other_2,$other_3,$date,$time);
		
// 		if($stmt_insert->execute())
// 		{
// 			return true;
// 		}
// 			return false;
// 	} 	
// }

		
// function get_all_flight_booking()
		
// 		{
// 			if($stmt_insert = $this->con->prepare("SELECT `id`, `transaction_id`, `booking_type`, `agent_id`, `from_location`, `to_location`, `travel_date`, `pax_size`, `tour_code`, `traveller_type`, `salutation`, `first_name`, `last_name`, `birth_dd`, `birth_mm`, `birth_year`, `ticket_status`, `ticket_amount`, `total_amount`, `commission`, `other_1`, `other_2`, `other_3`, `date`, `time` FROM `flight_booking`"))
// 			{	
// 				$stmt_insert->bind_result($id,$transaction_id,$booking_type,$agent_id,$from_location,$to_location,$travel_date,$pax_size,$tour_code,$traveller_type,$salutation,$first_name,$last_name,$birth_dd,$birth_mm,$birth_year,$ticket_status,$ticket_amount,$total_amount,$commission,$other_1,$other_2,$other_3,$date,$time);
				
// 				if($stmt_insert->execute())
// 				{
// 					$counter	=	0;
// 					$details	=	array();
// 					while($stmt_insert->fetch())
// 					{
						
// 						$details[$counter][0]	=	$id;
// 						$details[$counter][1]	=	$transaction_id;
// 						$details[$counter][2]	=	$booking_type;
// 						$details[$counter][3]	=	$agent_id;
// 						$details[$counter][4]	=	$from_location;
// 						$details[$counter][5]	=	$to_location;
// 						$details[$counter][6]	=	$travel_date;	
// 						$details[$counter][7]	=	$pax_size;
// 						$details[$counter][8]	=	$tour_code;
// 						$details[$counter][9]	=	$traveller_type;
// 						$details[$counter][10]	=	$salutation;
// 						$details[$counter][11]	=	$first_name;
// 						$details[$counter][12]	=	$last_name;
// 						$details[$counter][13]	=	$birth_dd;
// 						$details[$counter][14]	=	$birth_mm;
// 						$details[$counter][15]	=	$birth_year;
// 						$details[$counter][16]	=	$ticket_status;
// 						$details[$counter][17]	=	$ticket_amount;
// 						$details[$counter][18]	=	$total_amount;
// 						$details[$counter][19]	=	$commission;
// 						$details[$counter][20]	=	$other_1;
// 						$details[$counter][21]	=	$other_2;
// 						$details[$counter][22]	=	$other_3;
// 						$details[$counter][23]	=	$date;
// 						$details[$counter][24]	=	$time;					
					
// 						$counter++;
// 					}
// 					if(!empty($details))	
// 					{
// 						return $details;
// 					}
// 					return false;
// 				}	
// 			}
// 		}

// 		function get_all_flight_booking_for_ticket($res_edit_id)
// 		{
// 			if($stmt_insert = $this->con->prepare("SELECT `id`, `transaction_id`, `booking_type`, `agent_id`, `from_location`, `to_location`, `travel_date`, `pax_size`, `tour_code`, `traveller_type`, `salutation`, `first_name`, `last_name`, `birth_dd`, `birth_mm`, `birth_year`, `ticket_status`, `ticket_amount`, `total_amount`, `commission`, `other_1`, `other_2`, `other_3`, `date`, `time` FROM `flight_booking` where `id`=?"))
// 			{	

// 				$stmt_insert->bind_param("s",$res_edit_id);
// 				$stmt_insert->bind_result($id,$transaction_id,$booking_type,$agent_id,$from_location,$to_location,$travel_date,$pax_size,$tour_code,$traveller_type,$salutation,$first_name,$last_name,$birth_dd,$birth_mm,$birth_year,$ticket_status,$ticket_amount,$total_amount,$commission,$other_1,$other_2,$other_3,$date,$time);
				
// 				if($stmt_insert->execute())
// 				{
// 					$counter	=	0;
// 					$details	=	array();
// 					while($stmt_insert->fetch())
// 					{
						
// 						$details[$counter][0]	=	$id;
// 						$details[$counter][1]	=	$transaction_id;
// 						$details[$counter][2]	=	$booking_type;
// 						$details[$counter][3]	=	$agent_id;
// 						$details[$counter][4]	=	$from_location;
// 						$details[$counter][5]	=	$to_location;
// 						$details[$counter][6]	=	$travel_date;	
// 						$details[$counter][7]	=	$pax_size;
// 						$details[$counter][8]	=	$tour_code;
// 						$details[$counter][9]	=	$traveller_type;
// 						$details[$counter][10]	=	$salutation;
// 						$details[$counter][11]	=	$first_name;
// 						$details[$counter][12]	=	$last_name;
// 						$details[$counter][13]	=	$birth_dd;
// 						$details[$counter][14]	=	$birth_mm;
// 						$details[$counter][15]	=	$birth_year;
// 						$details[$counter][16]	=	$ticket_status;
// 						$details[$counter][17]	=	$ticket_amount;
// 						$details[$counter][18]	=	$total_amount;
// 						$details[$counter][19]	=	$commission;
// 						$details[$counter][20]	=	$other_1;
// 						$details[$counter][21]	=	$other_2;
// 						$details[$counter][22]	=	$other_3;
// 						$details[$counter][23]	=	$date;
// 						$details[$counter][24]	=	$time;					
					
// 						$counter++;
// 					}
// 					if(!empty($details))	
// 					{
// 						return $details;
// 					}
// 					return false;
// 				}	
// 			}
// 		}

// function delete_flight_booking($delete_id)
// 		{
// 			if($stmt_select = $this->con->prepare("DELETE FROM `flight_booking` WHERE`id`=?"))
// 			{
// 				$stmt_select->bind_param("i",$delete_id);
			
// 				if($stmt_select->execute())
// 				{					
// 						return true;
// 				}
// 					return false;
// 			}
// 		}


//  function update_flight_booking($transaction_id,$booking_type,$agent_id,$from_location,$to_location,$travel_date,$pax_size,$tour_code,$traveller_type,$salutation,$first_name,$last_name,$birth_dd,$birth_mm,$birth_year,$ticket_status,$ticket_amount,$total_amount,$commission,$other_1,$other_2,$other_3,$res_edit_id) 
//  {
//         $date = date("Y-m-d");
//         $time = date("H:i:s A");

//         if ($stmt_insert = $this->con->prepare("UPDATE `flight_booking` SET `transaction_id`=?,`booking_type`=?,`agent_id`=?,`from_location`=?,`to_location`=?,`travel_date`=?,`pax_size`=?,`tour_code`=?,`traveller_type`=?,`salutation`=?,`first_name`=?,`last_name`=?,`birth_dd`=?,`birth_mm`=?,`birth_year`=?,`ticket_status`=?,`ticket_amount`=?,`total_amount`=?,`commission`=?,`other_1`=?,`other_2`=?,`other_3`=?,`date`=?,`time`=? WHERE `id`=?")) {
//             $stmt_insert->bind_param("ssssssssssssssssssssssssi",$transaction_id,$booking_type,$agent_id,$from_location,$to_location,$travel_date,$pax_size,$tour_code,$traveller_type,$salutation,$first_name,$last_name,$birth_dd,$birth_mm,$birth_year,$ticket_status,$ticket_amount,$total_amount,$commission,$other_1,$other_2,$other_3,$date,$time,$res_edit_id);

//             if ($stmt_insert->execute()) {
//                 return true;
//             }
//             return false;
//         } else {
//             return false;
//         }
//     }



function add_flight_booking($transaction_id,$booking_type,$agent_id,$from_location,$to_location,$travel_date,$pax_size,$tour_code,$traveller_type,$salutation,$first_name,$last_name,$birth_dd,$birth_mm,$birth_year,$ticket_status,$ticket_amount,$total_amount,$commission,$other_1,$other_2,$other_3,$booking_id,$pnr_no,$flight_no,$arrival_time,$departure_time)
{
	$date = date("Y-m-d");
	$time = date("H-i-s A");
	$passanger_total="";
	if($stmt_insert = $this->con->prepare("INSERT INTO `flight_booking`(`transaction_id`, `booking_type`, `agent_id`, `from_location`, `to_location`, `travel_date`, `pax_size`, `tour_code`, `traveller_type`, `salutation`, `first_name`, `last_name`, `birth_dd`, `birth_mm`, `birth_year`, `ticket_status`, `ticket_amount`, `total_amount`, `commission`, `other_1`, `other_2`, `other_3`, `date`, `time`, `booking_id`, `pnr_no`, `flight_no`, `arrival_time`, `departure_time`,`passanger_total`) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"))
	{
		$stmt_insert->bind_param("ssssssssssssssssssssssssssssss",$transaction_id,$booking_type,$agent_id,$from_location,$to_location,$travel_date,$pax_size,$tour_code,$traveller_type,$salutation,$first_name,$last_name,$birth_dd,$birth_mm,$birth_year,$ticket_status,$ticket_amount,$total_amount,$commission,$other_1,$other_2,$other_3,$date,$time,$booking_id,$pnr_no,$flight_no,$arrival_time,$departure_time,$passanger_total);
		
		if($stmt_insert->execute())
		{
			return true;
		}
			return false;
	} 	
}

		
function get_all_flight_booking()
		
		{
			if($stmt_insert = $this->con->prepare("SELECT `id`, `transaction_id`, `booking_type`, `agent_id`, `from_location`, `to_location`, `travel_date`, `pax_size`, `tour_code`, `traveller_type`, `salutation`, `first_name`, `last_name`, `birth_dd`, `birth_mm`, `birth_year`, `ticket_status`, `ticket_amount`, `total_amount`, `commission`, `other_1`, `other_2`, `other_3`, `date`, `time`, `booking_id`, `pnr_no`, `flight_no`, `arrival_time`, `departure_time` FROM `flight_booking`"))
			{	
				$stmt_insert->bind_result($id,$transaction_id,$booking_type,$agent_id,$from_location,$to_location,$travel_date,$pax_size,$tour_code,$traveller_type,$salutation,$first_name,$last_name,$birth_dd,$birth_mm,$birth_year,$ticket_status,$ticket_amount,$total_amount,$commission,$other_1,$other_2,$other_3,$date,$time,$booking_id,$pnr_no,$flight_no,$arrival_time,$departure_time);
				
				if($stmt_insert->execute())
				{
					$counter	=	0;
					$details	=	array();
					while($stmt_insert->fetch())
					{
						
						$details[$counter][0]	=	$id;
						$details[$counter][1]	=	$transaction_id;
						$details[$counter][2]	=	$booking_type;
						$details[$counter][3]	=	$agent_id;
						$details[$counter][4]	=	$from_location;
						$details[$counter][5]	=	$to_location;
						$details[$counter][6]	=	$travel_date;	
						$details[$counter][7]	=	$pax_size;
						$details[$counter][8]	=	$tour_code;
						$details[$counter][9]	=	$traveller_type;
						$details[$counter][10]	=	$salutation;
						$details[$counter][11]	=	$first_name;
						$details[$counter][12]	=	$last_name;
						$details[$counter][13]	=	$birth_dd;
						$details[$counter][14]	=	$birth_mm;
						$details[$counter][15]	=	$birth_year;
						$details[$counter][16]	=	$ticket_status;
						$details[$counter][17]	=	$ticket_amount;
						$details[$counter][18]	=	$total_amount;
						$details[$counter][19]	=	$commission;
						$details[$counter][20]	=	$other_1;
						$details[$counter][21]	=	$other_2;
						$details[$counter][22]	=	$other_3;
						$details[$counter][23]	=	$date;
						$details[$counter][24]	=	$time;	

						$details[$counter][25]	=	$booking_id;	
						$details[$counter][26]	=	$pnr_no;	
						$details[$counter][27]	=	$flight_no;	
						$details[$counter][28]	=	$arrival_time;	
						$details[$counter][29]	=	$departure_time;							
					
						$counter++;
					}
					if(!empty($details))	
					{
						return $details;
					}
					return false;
				}	
			}
		}
	
	function get_all_flight_booking_for_search($from_date,$to_date,$from_loc,$to_loc,$status,$customer_name)
		
		{

			$from_location_stmt = "";

			if($from_loc!="")
			{
				$from_location_stmt = " AND `from_location` LIKE '%".$from_loc."%'";
			}

			
			$to_location_stmt = "";

			if($to_loc!="")
			{
				$to_location_stmt = " AND `to_location` LIKE '%".$to_loc."%'";
			}

			$status_stmt = "";

			if($status!="Select" AND $status!="")
			{
				$status_stmt = " AND `ticket_status`= '".$status."'";
			}

			$customer_name_statement = "";

			if($customer_name!="")
			{
				$customer_name_statement = " AND `first_name` LIKE '%".$customer_name."%'";
			}

			if($stmt_insert = $this->con->prepare("SELECT `id`, `transaction_id`, `booking_type`, `agent_id`, `from_location`, `to_location`, `travel_date`, `pax_size`, `tour_code`, `traveller_type`, `salutation`, `first_name`, `last_name`, `birth_dd`, `birth_mm`, `birth_year`, `ticket_status`, `ticket_amount`, `total_amount`, `commission`, `other_1`, `other_2`, `other_3`, `date`, `time`, `booking_id`, `pnr_no`, `flight_no`, `arrival_time`, `departure_time` FROM `flight_booking` WHERE (`travel_date` between ?  AND ?)".$from_location_stmt.$to_location_stmt.$status_stmt.$customer_name_statement))
			{	
				$stmt_insert->bind_param("ss",$from_date,$to_date);
				$stmt_insert->bind_result($id,$transaction_id,$booking_type,$agent_id,$from_location,$to_location,$travel_date,$pax_size,$tour_code,$traveller_type,$salutation,$first_name,$last_name,$birth_dd,$birth_mm,$birth_year,$ticket_status,$ticket_amount,$total_amount,$commission,$other_1,$other_2,$other_3,$date,$time,$booking_id,$pnr_no,$flight_no,$arrival_time,$departure_time);
				
				if($stmt_insert->execute())
				{
					$counter	=	0;
					$details	=	array();
					while($stmt_insert->fetch())
					{
						
						$details[$counter][0]	=	$id;
						$details[$counter][1]	=	$transaction_id;
						$details[$counter][2]	=	$booking_type;
						$details[$counter][3]	=	$agent_id;
						$details[$counter][4]	=	$from_location;
						$details[$counter][5]	=	$to_location;
						$details[$counter][6]	=	$travel_date;	
						$details[$counter][7]	=	$pax_size;
						$details[$counter][8]	=	$tour_code;
						$details[$counter][9]	=	$traveller_type;
						$details[$counter][10]	=	$salutation;
						$details[$counter][11]	=	$first_name;
						$details[$counter][12]	=	$last_name;
						$details[$counter][13]	=	$birth_dd;
						$details[$counter][14]	=	$birth_mm;
						$details[$counter][15]	=	$birth_year;
						$details[$counter][16]	=	$ticket_status;
						$details[$counter][17]	=	$ticket_amount;
						$details[$counter][18]	=	$total_amount;
						$details[$counter][19]	=	$commission;
						$details[$counter][20]	=	$other_1;
						$details[$counter][21]	=	$other_2;
						$details[$counter][22]	=	$other_3;
						$details[$counter][23]	=	$date;
						$details[$counter][24]	=	$time;	

						$details[$counter][25]	=	$booking_id;	
						$details[$counter][26]	=	$pnr_no;	
						$details[$counter][27]	=	$flight_no;	
						$details[$counter][28]	=	$arrival_time;	
						$details[$counter][29]	=	$departure_time;							
					
						$counter++;
					}
					if(!empty($details))	
					{
						return $details;
					}
					return false;
				}	
			}
		}
	


	function get_all_flight_booking_for_search_confirmed($res_edit_id)
		{

			 if ($stmt_insert = $this->con->prepare("SELECT id, transaction_id, booking_type, agent_id, from_location, to_location, travel_date, pax_size, tour_code, traveller_type, salutation, first_name, last_name, birth_dd, birth_mm, birth_year, ticket_status, ticket_amount, total_amount, commission, other_1, other_2, other_3, date, time, booking_id, pnr_no, flight_no, arrival_time, departure_time FROM flight_booking WHERE ticket_status='Confirm' AND agent_id=? ")) 
     
			{	
				$stmt_insert->bind_param("ss",$res_edit_id);
				$stmt_insert->bind_result($id,$transaction_id,$booking_type,$agent_id,$from_location,$to_location,$travel_date,$pax_size,$tour_code,$traveller_type,$salutation,$first_name,$last_name,$birth_dd,$birth_mm,$birth_year,$ticket_status,$ticket_amount,$total_amount,$commission,$other_1,$other_2,$other_3,$date,$time,$booking_id,$pnr_no,$flight_no,$arrival_time,$departure_time);
				
				if($stmt_insert->execute())
				{
					$counter	=	0;
					$details	=	array();
					while($stmt_insert->fetch())
					{
						
						$details[$counter][0]	=	$id;
						$details[$counter][1]	=	$transaction_id;
						$details[$counter][2]	=	$booking_type;
						$details[$counter][3]	=	$agent_id;
						$details[$counter][4]	=	$from_location;
						$details[$counter][5]	=	$to_location;
						$details[$counter][6]	=	$travel_date;	
						$details[$counter][7]	=	$pax_size;
						$details[$counter][8]	=	$tour_code;
						$details[$counter][9]	=	$traveller_type;
						$details[$counter][10]	=	$salutation;
						$details[$counter][11]	=	$first_name;
						$details[$counter][12]	=	$last_name;
						$details[$counter][13]	=	$birth_dd;
						$details[$counter][14]	=	$birth_mm;
						$details[$counter][15]	=	$birth_year;
						$details[$counter][16]	=	$ticket_status;
						$details[$counter][17]	=	$ticket_amount;
						$details[$counter][18]	=	$total_amount;
						$details[$counter][19]	=	$commission;
						$details[$counter][20]	=	$other_1;
						$details[$counter][21]	=	$other_2;
						$details[$counter][22]	=	$other_3;
						$details[$counter][23]	=	$date;
						$details[$counter][24]	=	$time;	

						$details[$counter][25]	=	$booking_id;	
						$details[$counter][26]	=	$pnr_no;	
						$details[$counter][27]	=	$flight_no;	
						$details[$counter][28]	=	$arrival_time;	
						$details[$counter][29]	=	$departure_time;							
					
						$counter++;
					}
					if(!empty($details))	
					{
						return $details;
					}
					return false;
				}	
			}
		}


function get_all_flight_booking_for_search_cancelled($res_edit_id)

		{
			

			 if ($stmt_insert = $this->con->prepare("SELECT id, transaction_id, booking_type, agent_id, from_location, to_location, travel_date, pax_size, tour_code, traveller_type, salutation, first_name, last_name, birth_dd, birth_mm, birth_year, ticket_status, ticket_amount, total_amount, commission, other_1, other_2, other_3, date, time, booking_id, pnr_no, flight_no, arrival_time, departure_time FROM flight_booking WHERE ticket_status='Cancelled' AND agent_id=?")) 
			{	
				$stmt_insert->bind_param("s",$res_edit_id);
				$stmt_insert->bind_result($id,$transaction_id,$booking_type,$agent_id,$from_location,$to_location,$travel_date,$pax_size,$tour_code,$traveller_type,$salutation,$first_name,$last_name,$birth_dd,$birth_mm,$birth_year,$ticket_status,$ticket_amount,$total_amount,$commission,$other_1,$other_2,$other_3,$date,$time,$booking_id,$pnr_no,$flight_no,$arrival_time,$departure_time);
				
				if($stmt_insert->execute())
				{
					$counter	=	0;
					$details	=	array();
					while($stmt_insert->fetch())
					{
						
						$details[$counter][0]	=	$id;
						$details[$counter][1]	=	$transaction_id;
						$details[$counter][2]	=	$booking_type;
						$details[$counter][3]	=	$agent_id;
						$details[$counter][4]	=	$from_location;
						$details[$counter][5]	=	$to_location;
						$details[$counter][6]	=	$travel_date;	
						$details[$counter][7]	=	$pax_size;
						$details[$counter][8]	=	$tour_code;
						$details[$counter][9]	=	$traveller_type;
						$details[$counter][10]	=	$salutation;
						$details[$counter][11]	=	$first_name;
						$details[$counter][12]	=	$last_name;
						$details[$counter][13]	=	$birth_dd;
						$details[$counter][14]	=	$birth_mm;
						$details[$counter][15]	=	$birth_year;
						$details[$counter][16]	=	$ticket_status;
						$details[$counter][17]	=	$ticket_amount;
						$details[$counter][18]	=	$total_amount;
						$details[$counter][19]	=	$commission;
						$details[$counter][20]	=	$other_1;
						$details[$counter][21]	=	$other_2;
						$details[$counter][22]	=	$other_3;
						$details[$counter][23]	=	$date;
						$details[$counter][24]	=	$time;	

						$details[$counter][25]	=	$booking_id;	
						$details[$counter][26]	=	$pnr_no;	
						$details[$counter][27]	=	$flight_no;	
						$details[$counter][28]	=	$arrival_time;	
						$details[$counter][29]	=	$departure_time;							
					
						$counter++;
					}
					if(!empty($details))	
					{
						return $details;
					}
					return false;
				}	
			}
		}


function get_all_flight_booking_for_agent($current_login_admin)
		
		{
			if($stmt_insert = $this->con->prepare("SELECT `id`, `transaction_id`, `booking_type`, `agent_id`, `from_location`, `to_location`, `travel_date`, `pax_size`, `tour_code`, `traveller_type`, `salutation`, `first_name`, `last_name`, `birth_dd`, `birth_mm`, `birth_year`, `ticket_status`, `ticket_amount`, `total_amount`, `commission`, `other_1`, `other_2`, `other_3`, `date`, `time`, `booking_id`, `pnr_no`, `flight_no`, `arrival_time`, `departure_time` FROM `flight_booking` WHERE `agent_id`=?"))
			{	
				$stmt_insert->bind_param("s",$current_login_admin);
				$stmt_insert->bind_result($id,$transaction_id,$booking_type,$agent_id,$from_location,$to_location,$travel_date,$pax_size,$tour_code,$traveller_type,$salutation,$first_name,$last_name,$birth_dd,$birth_mm,$birth_year,$ticket_status,$ticket_amount,$total_amount,$commission,$other_1,$other_2,$other_3,$date,$time,$booking_id,$pnr_no,$flight_no,$arrival_time,$departure_time);
				
				if($stmt_insert->execute())
				{
					$counter	=	0;
					$details	=	array();
					while($stmt_insert->fetch())
					{
						
						$details[$counter][0]	=	$id;
						$details[$counter][1]	=	$transaction_id;
						$details[$counter][2]	=	$booking_type;
						$details[$counter][3]	=	$agent_id;
						$details[$counter][4]	=	$from_location;
						$details[$counter][5]	=	$to_location;
						$details[$counter][6]	=	$travel_date;	
						$details[$counter][7]	=	$pax_size;
						$details[$counter][8]	=	$tour_code;
						$details[$counter][9]	=	$traveller_type;
						$details[$counter][10]	=	$salutation;
						$details[$counter][11]	=	$first_name;
						$details[$counter][12]	=	$last_name;
						$details[$counter][13]	=	$birth_dd;
						$details[$counter][14]	=	$birth_mm;
						$details[$counter][15]	=	$birth_year;
						$details[$counter][16]	=	$ticket_status;
						$details[$counter][17]	=	$ticket_amount;
						$details[$counter][18]	=	$total_amount;
						$details[$counter][19]	=	$commission;
						$details[$counter][20]	=	$other_1;
						$details[$counter][21]	=	$other_2;
						$details[$counter][22]	=	$other_3;
						$details[$counter][23]	=	$date;
						$details[$counter][24]	=	$time;	

						$details[$counter][25]	=	$booking_id;	
						$details[$counter][26]	=	$pnr_no;	
						$details[$counter][27]	=	$flight_no;	
						$details[$counter][28]	=	$arrival_time;	
						$details[$counter][29]	=	$departure_time;							
					
						$counter++;
					}
					if(!empty($details))	
					{
						return $details;
					}
					return false;
				}	
			}
		}

function get_all_flight_booking_for_agent_search($current_login_admin,$afrom_date,$ato_date,$afrom_loc,$ato_loc,$astatus,$acustomer_name)
		{
			$from_location_stmt = "";

			if($afrom_loc!="")
			{
				$from_location_stmt = " AND `from_location` LIKE '%".$afrom_loc."%'";
			}

			
			$to_location_stmt = "";

			if($ato_loc!="")
			{
				$to_location_stmt = " AND `to_location` LIKE '%".$ato_loc."%'";
			}

			$status_stmt = "";

			if($astatus!="Select" AND $astatus!="")
			{
				$status_stmt = " AND `ticket_status`= '".$astatus."'";
			}

			$customer_name_statement = "";

			if($acustomer_name!="")
			{
				$customer_name_statement = " AND `first_name` LIKE '%".$acustomer_name."%'";
			}

			if($stmt_insert = $this->con->prepare("SELECT `id`, `transaction_id`, `booking_type`, `agent_id`, `from_location`, `to_location`, `travel_date`, `pax_size`, `tour_code`, `traveller_type`, `salutation`, `first_name`, `last_name`, `birth_dd`, `birth_mm`, `birth_year`, `ticket_status`, `ticket_amount`, `total_amount`, `commission`, `other_1`, `other_2`, `other_3`, `date`, `time`, `booking_id`, `pnr_no`, `flight_no`, `arrival_time`, `departure_time` FROM `flight_booking` WHERE `agent_id`=? AND (`date` between ? AND ?) ".$from_location_stmt.$to_location_stmt.$status_stmt .$customer_name_statement))
			{	
				$stmt_insert->bind_param("sss",$current_login_admin,$afrom_date,$ato_date);
				$stmt_insert->bind_result($id,$transaction_id,$booking_type,$agent_id,$from_location,$to_location,$travel_date,$pax_size,$tour_code,$traveller_type,$salutation,$first_name,$last_name,$birth_dd,$birth_mm,$birth_year,$ticket_status,$ticket_amount,$total_amount,$commission,$other_1,$other_2,$other_3,$date,$time,$booking_id,$pnr_no,$flight_no,$arrival_time,$departure_time);
				
				if($stmt_insert->execute())
				{
					$counter	=	0;
					$details	=	array();
					while($stmt_insert->fetch())
					{
						
						$details[$counter][0]	=	$id;
						$details[$counter][1]	=	$transaction_id;
						$details[$counter][2]	=	$booking_type;
						$details[$counter][3]	=	$agent_id;
						$details[$counter][4]	=	$from_location;
						$details[$counter][5]	=	$to_location;
						$details[$counter][6]	=	$travel_date;	
						$details[$counter][7]	=	$pax_size;
						$details[$counter][8]	=	$tour_code;
						$details[$counter][9]	=	$traveller_type;
						$details[$counter][10]	=	$salutation;
						$details[$counter][11]	=	$first_name;
						$details[$counter][12]	=	$last_name;
						$details[$counter][13]	=	$birth_dd;
						$details[$counter][14]	=	$birth_mm;
						$details[$counter][15]	=	$birth_year;
						$details[$counter][16]	=	$ticket_status;
						$details[$counter][17]	=	$ticket_amount;
						$details[$counter][18]	=	$total_amount;
						$details[$counter][19]	=	$commission;
						$details[$counter][20]	=	$other_1;
						$details[$counter][21]	=	$other_2;
						$details[$counter][22]	=	$other_3;
						$details[$counter][23]	=	$date;
						$details[$counter][24]	=	$time;	

						$details[$counter][25]	=	$booking_id;	
						$details[$counter][26]	=	$pnr_no;	
						$details[$counter][27]	=	$flight_no;	
						$details[$counter][28]	=	$arrival_time;	
						$details[$counter][29]	=	$departure_time;							
					
						$counter++;
					}
					if(!empty($details))	
					{
						return $details;
					}
					return false;
				}	
			}
		}


function get_all_flight_booking_for_agent_for_refund($current_login_admin)
		
		{
			if($stmt_insert = $this->con->prepare("SELECT `id`, `transaction_id`, `booking_type`, `agent_id`, `from_location`, `to_location`, `travel_date`, `pax_size`, `tour_code`, `traveller_type`, `salutation`, `first_name`, `last_name`, `birth_dd`, `birth_mm`, `birth_year`, `ticket_status`, `ticket_amount`, `total_amount`, `commission`, `other_1`, `other_2`, `other_3`, `date`, `time`, `booking_id`, `pnr_no`, `flight_no`, `arrival_time`, `departure_time` FROM `flight_booking` WHERE `agent_id`=?"))
			{	
				$stmt_insert->bind_param("s",$current_login_admin);
				$stmt_insert->bind_result($id,$transaction_id,$booking_type,$agent_id,$from_location,$to_location,$travel_date,$pax_size,$tour_code,$traveller_type,$salutation,$first_name,$last_name,$birth_dd,$birth_mm,$birth_year,$ticket_status,$ticket_amount,$total_amount,$commission,$other_1,$other_2,$other_3,$date,$time,$booking_id,$pnr_no,$flight_no,$arrival_time,$departure_time);
				
				if($stmt_insert->execute())
				{
					$counter	=	0;
					$details	=	array();
					while($stmt_insert->fetch())
					{
						
						$details[$counter][0]	=	$id;
						$details[$counter][1]	=	$transaction_id;
						$details[$counter][2]	=	$booking_type;
						$details[$counter][3]	=	$agent_id;
						$details[$counter][4]	=	$from_location;
						$details[$counter][5]	=	$to_location;
						$details[$counter][6]	=	$travel_date;	
						$details[$counter][7]	=	$pax_size;
						$details[$counter][8]	=	$tour_code;
						$details[$counter][9]	=	$traveller_type;
						$details[$counter][10]	=	$salutation;
						$details[$counter][11]	=	$first_name;
						$details[$counter][12]	=	$last_name;
						$details[$counter][13]	=	$birth_dd;
						$details[$counter][14]	=	$birth_mm;
						$details[$counter][15]	=	$birth_year;
						$details[$counter][16]	=	$ticket_status;
						$details[$counter][17]	=	$ticket_amount;
						$details[$counter][18]	=	$total_amount;
						$details[$counter][19]	=	$commission;
						$details[$counter][20]	=	$other_1;
						$details[$counter][21]	=	$other_2;
						$details[$counter][22]	=	$other_3;
						$details[$counter][23]	=	$date;
						$details[$counter][24]	=	$time;	

						$details[$counter][25]	=	$booking_id;	
						$details[$counter][26]	=	$pnr_no;	
						$details[$counter][27]	=	$flight_no;	
						$details[$counter][28]	=	$arrival_time;	
						$details[$counter][29]	=	$departure_time;							
					
						$counter++;
					}
					if(!empty($details))	
					{
						return $details;
					}
					return false;
				}	
			}
		}



		function get_all_flight_booking_for_ticket($res_edit_id)
		{
			if($stmt_insert = $this->con->prepare("SELECT `id`, `transaction_id`, `booking_type`, `agent_id`, `from_location`, `to_location`, `travel_date`, `pax_size`, `tour_code`, `traveller_type`, `salutation`, `first_name`, `last_name`, `birth_dd`, `birth_mm`, `birth_year`, `ticket_status`, `ticket_amount`, `total_amount`, `commission`, `other_1`, `other_2`, `other_3`, `date`, `time`, `booking_id`, `pnr_no`, `flight_no`, `arrival_time`, `departure_time`,`passanger_total` FROM `flight_booking` WHERE`id`=?"))
			{	

				$stmt_insert->bind_param("s",$res_edit_id);
				$stmt_insert->bind_result($id,$transaction_id,$booking_type,$agent_id,$from_location,$to_location,$travel_date,$pax_size,$tour_code,$traveller_type,$salutation,$first_name,$last_name,$birth_dd,$birth_mm,$birth_year,$ticket_status,$ticket_amount,$total_amount,$commission,$other_1,$other_2,$other_3,$date,$time,$booking_id,$pnr_no,$flight_no,$arrival_time,$departure_time,$passanger_total);
				
				if($stmt_insert->execute())
				{
					$counter	=	0;
					$details	=	array();
					while($stmt_insert->fetch())
					{
						
						$details[$counter][0]	=	$id;
						$details[$counter][1]	=	$transaction_id;
						$details[$counter][2]	=	$booking_type;
						$details[$counter][3]	=	$agent_id;
						$details[$counter][4]	=	$from_location;
						$details[$counter][5]	=	$to_location;
						$details[$counter][6]	=	$travel_date;	
						$details[$counter][7]	=	$pax_size;
						$details[$counter][8]	=	$tour_code;
						$details[$counter][9]	=	$traveller_type;
						$details[$counter][10]	=	$salutation;
						$details[$counter][11]	=	$first_name;
						$details[$counter][12]	=	$last_name;
						$details[$counter][13]	=	$birth_dd;
						$details[$counter][14]	=	$birth_mm;
						$details[$counter][15]	=	$birth_year;
						$details[$counter][16]	=	$ticket_status;
						$details[$counter][17]	=	$ticket_amount;
						$details[$counter][18]	=	$total_amount;
						$details[$counter][19]	=	$commission;
						$details[$counter][20]	=	$other_1;
						$details[$counter][21]	=	$other_2;
						$details[$counter][22]	=	$other_3;
						$details[$counter][23]	=	$date;
						$details[$counter][24]	=	$time;	


						$details[$counter][25]	=	$booking_id;	
						$details[$counter][26]	=	$pnr_no;	
						$details[$counter][27]	=	$flight_no;	
						$details[$counter][28]	=	$arrival_time;	
						$details[$counter][29]	=	$departure_time;	
						$details[$counter][30]	=	$passanger_total;						
											
					
						$counter++;
					}
					if(!empty($details))	
					{
						return $details;
					}
					return false;
				}	
			}
		}

function delete_flight_booking($delete_id)
		{
			if($stmt_select = $this->con->prepare("DELETE FROM `flight_booking` WHERE`id`=?"))
			{
				$stmt_select->bind_param("i",$delete_id);
			
				if($stmt_select->execute())
				{					
						return true;
				}
					return false;
			}
		}


 function update_flight_booking($transaction_id,$booking_type,$agent_id,$from_location,$to_location,$travel_date,$pax_size,$tour_code,$traveller_type,$salutation,$first_name,$last_name,$birth_dd,$birth_mm,$birth_year,$ticket_status,$ticket_amount,$total_amount,$commission,$other_1,$other_2,$other_3,$booking_id,$pnr_no,$flight_no,$arrival_time,$departure_time,$res_edit_id) 
 {
        $date = date("Y-m-d");
        $time = date("H:i:s A");

        if ($stmt_insert = $this->con->prepare("UPDATE `flight_booking` SET `transaction_id`=?,`booking_type`=?,`agent_id`=?,`from_location`=?,`to_location`=?,`travel_date`=?,`pax_size`=?,`tour_code`=?,`traveller_type`=?,`salutation`=?,`first_name`=?,`last_name`=?,`birth_dd`=?,`birth_mm`=?,`birth_year`=?,`ticket_status`=?,`ticket_amount`=?,`total_amount`=?,`commission`=?,`other_1`=?,`other_2`=?,`other_3`=?,`date`=?,`time`=?,`booking_id`=?,`pnr_no`=?,`flight_no`=?,`arrival_time`=?,`departure_time`=? WHERE `id`=?")) 
		{
            $stmt_insert->bind_param("sssssssssssssssssssssssssssssi",$transaction_id,$booking_type,$agent_id,$from_location,$to_location,$travel_date,$pax_size,$tour_code,$traveller_type,$salutation,$first_name,$last_name,$birth_dd,$birth_mm,$birth_year,$ticket_status,$ticket_amount,$total_amount,$commission,$other_1,$other_2,$other_3,$date,$time,$booking_id,$pnr_no,$flight_no,$arrival_time,$departure_time,$res_edit_id);

            if ($stmt_insert->execute()) {
                return true;
            }
            return false;
        } else {
            return false;
        }
    }




	// 	function get_flight_booking_from_id($res_edit_id)
	// 	{ 
    //     if($stmt = $this->con->prepare("SELECT `id`, `transaction_id`, `booking_type`, `agent_id`, `from_location`, `to_location`, `travel_date`, `pax_size`, `tour_code`, `traveller_type`, `salutation`, `first_name`, `last_name`, `birth_dd`, `birth_mm`, `birth_year`, `ticket_status`, `ticket_amount`, `total_amount`, `commission`, `other_1`, `other_2`, `other_3`, `date`, `time`, `booking_id`, `pnr_no`, `flight_no`, `arrival_time`, `departure_time` FROM `flight_booking` WHERE `id`=?"))
	// 	{
    //         $stmt->bind_param("i",$res_edit_id);
    //         $stmt->bind_result($id,$transaction_id,$booking_type,$agent_id,$from_location,$to_location,$travel_date,$pax_size,$tour_code,$traveller_type,$salutation,$first_name,$last_name,$birth_dd,$birth_mm,$birth_year,$ticket_status,$ticket_amount,$total_amount,$commission,$other_1,$other_2,$other_3,$date,$time,$booking_id,$pnr_no,$flight_no,$arrival_time,$departure_time);
				
	// 		if($stmt->execute())
	// 		{
	// 			$users_data = array();
	// 			$counter = 0;
	// 		}
	// 		while($stmt->fetch())
	// 		{ 
    //         $users_data['id'] 								= $id;
	// 		$users_data['transaction_id'] 					= $transaction_id;
	// 		$users_data['booking_type'] 					= $booking_type;
	// 		$users_data['agent_id'] 						= $agent_id;
	// 		$users_data['from_location']					= $from_location;
	// 		$users_data['to_location'] 						= $to_location;
	// 		$users_data['travel_date'] 						= $travel_date;
	// 		$users_data['pax_size'] 						= $pax_size;
	// 		$users_data['tour_code'] 						= $tour_code;
	// 		$users_data['traveller_type'] 					= $traveller_type;
	// 		$users_data['salutation'] 						= $salutation;
	// 		$users_data['first_name'] 						= $first_name;
	// 		$users_data['last_name']						= $last_name;
	// 		$users_data['birth_dd'] 						= $birth_dd;
	// 		$users_data['birth_mm'] 						= $birth_mm;
	// 		$users_data['birth_year'] 						= $birth_year;
	// 		$users_data['ticket_status']					= $ticket_status;
	// 		$users_data['ticket_amount'] 					= $ticket_amount;
	// 		$users_data['total_amount'] 					= $total_amount;
	// 		$users_data['commission'] 						= $commission;
	// 		$users_data['other_1'] 							= $other_1;
	// 		$users_data['other_2'] 							= $other_1;
	// 		$users_data['other_3'] 							= $other_1;
	// 		$users_data['date']								= $date;
	// 		$users_data['time'] 							= $time;
			
	// 		$users_data['booking_id'] 						= $booking_id;
	// 		$users_data['pnr_no'] 							= $pnr_no;
	// 		$users_data['flight_no'] 						= $flight_no;
	// 		$users_data['arrival_time']						= $arrival_time;
	// 		$users_data['departure_time'] 					= $departure_time;
    //         }
    //             if(!empty($users_data))
	// 			{
    //                 return $users_data;
    //             }
    //             else
	// 			{
    //                 return false;
    //             }
    //     }
    // }


		function get_flight_booking_from_id($res_edit_id)
		{ 
        if($stmt = $this->con->prepare("SELECT `id`, `transaction_id`, `booking_type`, `agent_id`, `from_location`, `to_location`, `travel_date`, `pax_size`, `tour_code`, `traveller_type`, `salutation`, `first_name`, `last_name`, `birth_dd`, `birth_mm`, `birth_year`, `ticket_status`, `ticket_amount`, `total_amount`, `commission`, `other_1`, `other_2`, `other_3`, `date`, `time` FROM `flight_booking` WHERE `id`=?"))
		{
            $stmt->bind_param("i",$res_edit_id);
            $stmt->bind_result($id,$transaction_id,$booking_type,$agent_id,$from_location,$to_location,$travel_date,$pax_size,$tour_code,$traveller_type,$salutation,$first_name,$last_name,$birth_dd,$birth_mm,$birth_year,$ticket_status,$ticket_amount,$total_amount,$commission,$other_1,$other_2,$other_3,$date,$time);
				
			if($stmt->execute())
			{
				$users_data = array();
				$counter = 0;
			}
			while($stmt->fetch())
			{ 
            $users_data['id'] 								= $id;
			$users_data['transaction_id'] 					= $transaction_id;
			$users_data['booking_type'] 					= $booking_type;
			$users_data['agent_id'] 						= $agent_id;
			$users_data['from_location']					= $from_location;
			$users_data['to_location'] 						= $to_location;
			$users_data['travel_date'] 						= $travel_date;
			$users_data['pax_size'] 						= $pax_size;
			$users_data['tour_code'] 						= $tour_code;
			$users_data['traveller_type'] 					= $traveller_type;
			$users_data['salutation'] 						= $salutation;
			$users_data['first_name'] 						= $first_name;
			$users_data['last_name']						= $last_name;
			$users_data['birth_dd'] 						= $birth_dd;
			$users_data['birth_mm'] 						= $birth_mm;
			$users_data['birth_year'] 						= $birth_year;
			$users_data['ticket_status']					= $ticket_status;
			$users_data['ticket_amount'] 					= $ticket_amount;
			$users_data['total_amount'] 					= $total_amount;
			$users_data['commission'] 						= $commission;
			$users_data['other_1'] 							= $other_1;
			$users_data['other_2'] 							= $other_1;
			$users_data['other_3'] 							= $other_1;
			$users_data['date']								= $date;
			$users_data['time'] 							= $time;
            }
                if(!empty($users_data))
				{
                    return $users_data;
                }
                else
				{
                    return false;
                }
        }
    }


   // function update_recharge_amount($id) 
   // {
   //      if ($stmt = $this->con->prepare("UPDATE group_request SET `amount` = `amount` + `amount` WHERE `id` = ?"))
// 		{
   //          $stmt->bind_param('i', $id);

   //          if ($stmt->execute()) 
   //          {
   //              $stmt->close();
   //              return true;
   //          } 
   //          else 
   //          {
   //              $stmt->close();
   //              return false;
   //          }
   //      }
   //      return false;
   //  }
		

// function update_recharge_amount($agent_id,$amount) {

//     if ($stmt = $this->con->prepare("UPDATE register SET `wallet_balance` = + '$amount' WHERE `phone_number` = ?")) {
      
//         $stmt->bind_param('s', $agent_id);

//         if ($stmt->execute()) {
//             $stmt->close();
//             return true;
//         } else {
//             error_log("Error executing statement: " . $stmt->error);
            
//             $stmt->close();
//             return false;
//         }
//     } else {
//         error_log("Error preparing statement: " . $this->con->error);
//     }

//     return false;
// }



// function update_recharge_amount($amount, $agent_id) {
//     if ($stmt = $this->con->prepare("UPDATE `register` SET `wallet_balance` = +'$amount' WHERE `phone_number` = ?")) {
       
//         $stmt->bind_param('si', $amount, $agent_id);

//         if ($stmt->execute()) 
//         {
//             $stmt->close();
//             return true;
//         } else {
//             return false;
//         }
//     } else {
//         return false;
//     }
// }


// function update_recharge_amount($amount, $agent_id) 
// {

//     if ($stmt = $this->con->prepare("UPDATE `register` SET `wallet_balance` = `wallet_balance` + $amount  WHERE `phone_number` = ?")) {
       
//         $stmt->bind_param('ss',$amount,$agent_id);

//         if ($stmt->execute()) 
//         {
//             $stmt->close();
//             return true;
//         } else 
//         {
//             return false;
//         }
//     } 

// }

function update_recharge_amount($amount, $agent_id) 
{
    if ($stmt = $this->con->prepare("UPDATE `register` SET `wallet_balance` = `wallet_balance` + ? WHERE `phone_number` = ?")) {
        
        // Bind the parameters
        $stmt->bind_param('ds', $amount, $agent_id); // 'd' for double/float and 's' for string

        if ($stmt->execute()) {
            $stmt->close();
            return true;
        } else {
            // Log error message
            echo "Execute failed: (" . $stmt->errno . ") " . $stmt->error;
            return false;
        }
    } else {
        // Log error message
        echo "Prepare failed: (" . $this->con->errno . ") " . $this->con->error;
        return false;
    }
}


function get_all_register_for_vallet($current_login_admin)
		
		{
			if($stmt_insert = $this->con->prepare("SELECT `id`, `company_name`, `full_name`, `phone_number`, `whatsapp_number`, `email_address`, `referred_by`, `country`, `state`, `district`, `city`, `address`, `pin_code`, `status`, `your_locailty`, `nearest_airport`, `primary_business`, `monthly_busines`, `secondary_business`, `monthly_business`, `pan_no`, `company_gst_no`, `online_ota_1`, `online_ota_2`, `series_ota_1`, `series_ota_2`,`password`, `date`, `time`,`wallet_balance` FROM `register` WHERE  `phone_number`=?"))
			{	
				$stmt_insert->bind_param("s",$current_login_admin);
				$stmt_insert->bind_result($id,$company_name,$full_name,$phone_number,$whatsapp_number,$email_address,$referred_by,$country,$state,$district,$city,$address,$pin_code,$status,$your_locailty,$nearest_airport,$primary_business,$monthly_busines,$secondary_business,$monthly_business,$pan_no,$company_gst_no,$online_ota_1,$online_ota_2,$series_ota_1,$series_ota_2,$password,$date,$time,$wallet_balance);
				
				if($stmt_insert->execute())
				{
					$counter	=	0;
					$details	=	array();
					while($stmt_insert->fetch())
					{
						
						$details[$counter][0]	=	$id;
						$details[$counter][1]	=	$company_name;
						$details[$counter][2]	=	$full_name;
						$details[$counter][3]	=	$phone_number;
						$details[$counter][4]	=	$whatsapp_number;
						$details[$counter][5]	=	$email_address;
						$details[$counter][6]	=	$referred_by;	
						$details[$counter][7]	=	$country;
						$details[$counter][8]	=	$state;
						$details[$counter][9]	=	$district;
						$details[$counter][10]	=	$city;
						$details[$counter][11]	=	$address;
						$details[$counter][12]	=	$pin_code;
						$details[$counter][13]	=	$status;
						$details[$counter][14]	=	$your_locailty;
						$details[$counter][15]	=	$nearest_airport;
						$details[$counter][16]	=	$primary_business;
						$details[$counter][17]	=	$monthly_busines;
						$details[$counter][18]	=	$secondary_business;
						$details[$counter][19]	=	$monthly_business;
						$details[$counter][20]	=	$pan_no;
						$details[$counter][21]	=	$company_gst_no;
						$details[$counter][22]	=	$online_ota_1;
						$details[$counter][23]	=	$online_ota_2;
						$details[$counter][24]	=	$series_ota_1;
						$details[$counter][25]	=	$series_ota_2;
						$details[$counter][26]	=	$password;
						$details[$counter][27]	=	$date;
						$details[$counter][28]	=	$time;
						$details[$counter][29]	=	$wallet_balance;						
					
						$counter++;
					}
					if(!empty($details))	
					{
						return $details;
					}
					return false;
				}	
			}
		}


function count_entries_daily($phone_number) 
{
    if ($stmt = $this->con->prepare("SELECT COUNT(`id`)  FROM `upload_request` WHERE `status`='Block' AND `agent_id`=?")) 
    {
        $stmt->bind_param("s",$phone_number); 
        if ($stmt->execute()) {
            $stmt->bind_result($res_id);
            if ($stmt->fetch()) {

                return $res_id;
            }
        }
        $stmt->close();
    }
    return false;
}

function count_entries_weekly($phone_number) 
{
    if ($stmt = $this->con->prepare("SELECT COUNT(`id`)  FROM `upload_request` WHERE `status`='Pending' AND `agent_id`=?")) 
    {
        $stmt->bind_param("s",$phone_number); 
        if ($stmt->execute()) {
            $stmt->bind_result($res_id);
            if ($stmt->fetch()) {

                return $res_id;
            }
        }
        $stmt->close();
    }
    return false;
}

function count_entries_monthly($phone_number) 
{
    if ($stmt = $this->con->prepare("SELECT COUNT(`id`)  FROM `upload_request` WHERE `status`='Active' AND `agent_id`=?")) 
    {
        $stmt->bind_param("s",$phone_number); 
        if ($stmt->execute()) {
            $stmt->bind_result($res_id);
            if ($stmt->fetch()) {

                return $res_id;
            }
        }
        $stmt->close();
    }
    return false;
}


function count_ticket_confirm($agent_id) 
{
    if ($stmt = $this->con->prepare("SELECT COUNT(`id`) FROM `flight_booking` WHERE `ticket_status`='Confirm' AND `agent_id`=?")) 
    {
        $stmt->bind_param("s", $agent_id); 

        if ($stmt->execute()) {
            $stmt->bind_result($count);

            if ($stmt->fetch()) {
                $stmt->close();

                return $count;
            }
        }

        $stmt->close();
    }
    return false;
}


function count_ticket_amount($agent_id) 
{
    if ($stmt = $this->con->prepare("SELECT SUM(`ticket_amount`) FROM `flight_booking` WHERE `ticket_status`='Confirm' AND `agent_id`=?")) 
    {
        $stmt->bind_param("s", $agent_id); 

        if ($stmt->execute()) {
            $stmt->bind_result($count);

            if ($stmt->fetch()) {
                $stmt->close();

                return $count;
            }
        }

        $stmt->close();
    }
    return false;
}
function count_ticket_amount_cancel($agent_id) 
{
    if ($stmt = $this->con->prepare("SELECT SUM(`ticket_amount`) FROM `flight_booking` WHERE `ticket_status`='Cancelled' AND `agent_id`=?")) 
    {
        $stmt->bind_param("s", $agent_id); 

        if ($stmt->execute()) {
            $stmt->bind_result($count);

            if ($stmt->fetch()) {
                $stmt->close();

                return $count;
            }
        }

        $stmt->close();
    }
    return false;
}


function count_ticket_cancel($phone_number) 
{
    if ($stmt = $this->con->prepare("SELECT COUNT(`id`) FROM `flight_booking` WHERE `ticket_status`='Cancelled' AND `agent_id`=?")) 
    {
        $stmt->bind_param("s", $phone_number); 
        
        if ($stmt->execute()) {
            $stmt->bind_result($res_id);
            if ($stmt->fetch()) {
                return $res_id;
            }
        }
        $stmt->close();
    }
    return false;
}

 function insert_refund_request($ticket_id,$agent_id,$amount,$status,$message)
		{
			$date = date("Y-m-d");
			$time = date("H-i-s A");
			
			if($stmt_insert = $this->con->prepare("INSERT INTO `refund_reuests`( `ticket_id`, `agent_id`, `amount`, `status`, `message`, `date`, `time`) VALUES (?,?,?,?,?,?,?)"))
			{
				$stmt_insert->bind_param("sssssss",$ticket_id,$agent_id,$amount,$status,$message,$date,$time);
				
				if($stmt_insert->execute())
				{
					return true;
				}
					return false;
			} 	
		}

	function get_refund_data($ticket_id)
		{
			 if ($stmt_select = $this->con->prepare("SELECT `ticket_id` FROM `refund_reuests` WHERE `ticket_id` = ?"))
			{
				$stmt_select->bind_param("s",$ticket_id);
			
				$stmt_select->bind_result($result_id);
			
				if($stmt_select->execute())
				{
					if($stmt_select->fetch())
					{
						return $result_id;
					}
				}
				return false;
			}
		}


		function get_all_refund_request_for_agent($current_login_admin)
		{
			
			if($stmt_insert = $this->con->prepare("SELECT `id`, `ticket_id`, `agent_id`, `amount`, `status`, `message`, `date`, `time` FROM `refund_reuests` WHERE `agent_id`=? AND `status`='Pending'"))
				
				{
					$stmt_insert->bind_param("s",$current_login_admin);
					$stmt_insert->bind_result($id,$ticket_id,$agent_id,$amount,$status,$message,$date,$time);
				
				if($stmt_insert->execute())
				{
					$counter	=	0;
					$details	=	array();
					while($stmt_insert->fetch())
					{
						$details[$counter][0]	=	$id;
						$details[$counter][1]	=	$ticket_id;
						$details[$counter][2]	=	$agent_id;
						$details[$counter][3]	=	$amount;
						$details[$counter][4]	=	$status;
						$details[$counter][5]	=	$message;
						$details[$counter][6]	=	$date;
						$details[$counter][7]	=	$time;
					
					
						$counter++;
					}
					if(!empty($details))	
					{
						return $details;
					}
					return false;
				}	
			}
		}


		function get_all_refund_request_for_agent_approved($current_login_admin)
		{
			
			if($stmt_insert = $this->con->prepare("SELECT `id`, `ticket_id`, `agent_id`, `amount`, `status`, `message`, `date`, `time` FROM `refund_reuests` WHERE `agent_id`=? AND `status`='Active'"))
				
				{
					$stmt_insert->bind_param("s",$current_login_admin);
					$stmt_insert->bind_result($id,$ticket_id,$agent_id,$amount,$status,$message,$date,$time);
				
				if($stmt_insert->execute())
				{
					$counter	=	0;
					$details	=	array();
					while($stmt_insert->fetch())
					{
						$details[$counter][0]	=	$id;
						$details[$counter][1]	=	$ticket_id;
						$details[$counter][2]	=	$agent_id;
						$details[$counter][3]	=	$amount;
						$details[$counter][4]	=	$status;
						$details[$counter][5]	=	$message;
						$details[$counter][6]	=	$date;
						$details[$counter][7]	=	$time;
					
					
						$counter++;
					}
					if(!empty($details))	
					{
						return $details;
					}
					return false;
				}	
			}
		}
		function get_all_refund_request_for_admin($refrom_date,$reto_date,$reamount)
		{
			$stmt_reamount = "";

			if($reamount!="")
			{
				$stmt_reamount = " AND `amount` LIKE '%".$reamount."%'";
			}
			// $stmt_paymethod = "";

			// if ($rep_method!="" && $rep_method != "Select")
			// {
			// 	$stmt_paymethod = " AND `agent_id`= '".$rep_method."'";
			// }
			// else
			// {
			//     $stmt_paymethod = " `agent_id` LIKE '%%'";
			// }

			if($stmt_insert = $this->con->prepare("SELECT `id`, `ticket_id`, `agent_id`, `amount`, `status`, `message`, `date`, `time` FROM `refund_reuests` where `status`='Pending' AND (`date` between ? AND ?)" .$stmt_reamount))
				{
					$stmt_insert -> bind_param("ss",$refrom_date,$reto_date);
				$stmt_insert->bind_result($id,$ticket_id,$agent_id,$amount,$status,$message,$date,$time);
				
				if($stmt_insert->execute())
				{
					$counter	=	0;
					$details	=	array();
					while($stmt_insert->fetch())
					{
						$details[$counter][0]	=	$id;
						$details[$counter][1]	=	$ticket_id;
						$details[$counter][2]	=	$agent_id;
						$details[$counter][3]	=	$amount;
						$details[$counter][4]	=	$status;
						$details[$counter][5]	=	$message;
						$details[$counter][6]	=	$date;
						$details[$counter][7]	=	$time;
						$counter++;
					}
					if(!empty($details))	
					{
						return $details;
					}
					return false;
				}	
			}
		}
		function delete_refund_request($delete_id)
		{
			if($stmt_select = $this->con->prepare("DELETE FROM `refund_reuests` WHERE  `id`=?"))
			{
				$stmt_select->bind_param("i",$delete_id);
			
				if($stmt_select->execute())
				{					
						return true;
				}
					return false;
			}
		}
	function get_refund_data_for_edit($res_edit_id)
		{ 
        if($stmt = $this->con->prepare("SELECT  `id`, `amount`, `message`, `date`, `time` FROM `refund_reuests` WHERE `id`=?"))
		{ 
            $stmt->bind_param("i",$res_edit_id);
            $stmt->bind_result($id,$amount,$message,$date,$time);
				
			if($stmt->execute())
			{
				$users_data = array();
				$counter = 0;
			}
			while($stmt->fetch())
			{ 
           		$users_data['id']             		 	=    $id;								
				$users_data['amount']             	=    $amount;					
				$users_data['message']           	=    $message;						  
				$users_data['date']                         =    $date;							
				$users_data['time']                         =    $time;		
			}
                if(!empty($users_data))
				{
                    return $users_data;
                }
                else
				{
                    return false;
                }
        }
    }

    function update_refund($amount,$message,$res_edit_id)
		{ 
			$date = date("Y-m-d");
			$time = date("H-i-s A");
			
			if($stmt_insert = $this->con->prepare("UPDATE `refund_reuests` SET `amount`=?,`message`=?,`date`=?,`time`=? WHERE `id`= ?"))
			{ 
				$stmt_insert->bind_param("ssssi",$amount,$message,$date,$time,$res_edit_id);
				
				if($stmt_insert->execute())
				{
					return true;
				}
				return false;
			} 	
		}

	function delete_temparory_credit($delete_id)
		{
			if($stmt_select = $this->con->prepare("DELETE FROM `upload_request` WHERE  `id`=?"))
			{
				$stmt_select->bind_param("i",$delete_id);
			
				if($stmt_select->execute())
				{					
						return true;
				}
					return false;
			}
		}

function set_status_active_refund($id,$status) {
        if ($stmt = $this->con->prepare("UPDATE refund_reuests SET status = '$status' WHERE id = ?")) 
		{
            $stmt->bind_param('i', $id);

            if ($stmt->execute()) {
                $stmt->close();
                return true;
            } else {
                $stmt->close();
                return false;
            }
        }

        return false;
    }

// function refund_cancelled_ticket($amount, $agent_id) 
// {

//     if ($stmt = $this->con->prepare("UPDATE `register` SET `wallet_balance` = `wallet_balance` + ?  WHERE `phone_number` = ?")) {
       
//         $stmt->bind_param('ss', $amount, $agent_id); 

//         if ($stmt->execute()) {
//             $stmt->close();
//             return true;
//         } else {
//             return false;
//         }
//     } else {
//         return false; 
//     }
// }

function refund_cancelled_ticket($amount, $agent_id) {
    if ($stmt = $this->con->prepare("UPDATE `register` SET `wallet_balance` = `wallet_balance` + ? WHERE `phone_number` = ?")) {
        $stmt->bind_param('ss', $amount, $agent_id);

        if ($stmt->execute()) {
            $stmt->close();
            return true;
        } else {
            $stmt->close();
            return false;
        }
    } else {
        return false;
    }
}

	function update_flight_status($id,$status) 
		{
        if ($stmt = $this->con->prepare("UPDATE flight_booking SET ticket_status = 'Cancelled' WHERE id = ?")) {
            $stmt->bind_param('i', $id);

            if ($stmt->execute()) {
                $stmt->close();
                return true;
            } else {
                $stmt->close();
                return false;
            }
        }

        return false;
    }
function get_agent_name_from_id($agent_id)
		{
			
			if($stmt_insert = $this->con->prepare("SELECT `full_name` FROM `register` WHERE `phone_number`=?"))
			{	
				$stmt_insert->bind_param("i",$agent_id);
				
				$stmt_insert->bind_result($res_select_agent);
				
				if($stmt_insert->execute())
				{
					if($stmt_insert->fetch())
					{
						return $res_select_agent;
					}
					return false;
				}	
			}
		}



function get_temparory_credit_data_for_edit($res_edit_id)
		{ 
        if($stmt = $this->con->prepare("SELECT `id`, `agent_id`, `amount`, `reference_no`, `payment_method`,  `message`,  `date`, `time`,`temp_credit` FROM `upload_request` WHERE `id`=?"))
		{
            $stmt->bind_param("i",$res_edit_id);
            $stmt->bind_result($id, $agent_id, $amount, $reference_no, $payment_method, $message,$date,$time,$temp_credit);
			
			if($stmt->execute())
			{
				$users_data = array();
				$counter = 0;
			}
			while($stmt->fetch())
			{ 
            $users_data['id'] 							= $id;
			$users_data['agent_id'] 					= $agent_id;
			 $users_data['amount'] 						= $amount;
			$users_data['reference_no'] 				= $reference_no;
			$users_data['payment_method']				= $payment_method;
			$users_data['message'] 						= $message;
			$users_data['date']							= $date;
			$users_data['time'] 						= $time;
			$users_data['temp_credit'] 					= $temp_credit;
            }
                if(!empty($users_data))
				{
                    return $users_data;
                }
                else
				{
                    return false;
                }
        }
    }

function update_temparory_credit($agent_id,$payment_method,$message,$amount,$res_edit_id) {
    
    $date = date("Y-m-d");
    $time = date("H-i-s A");

    if ($stmt_insert = $this->con->prepare("UPDATE `upload_request` SET `agent_id`=?,`payment_method`=?,`message`=?,`date`=?,`time`=?,`temp_credit`=? WHERE `id`=?")) {
        $stmt_insert->bind_param("ssssssi", $agent_id, $payment_method, $message, $date, $time, $amount, $res_edit_id);
        
        if ($stmt_insert->execute()) {
            return true;
        } else {
            return false;
        }
    } else {
        return false;
    }
}
	function get_all_refund_request_for_agent_from_date($current_login_admin,$refrom_date,$reto_date,$reamount,$reagent)
		{
			$stmt_reamount = "";

			if($reamount!="")
			{
				$stmt_reamount = " AND `amount` LIKE '%".$reamount."%'";
			}


			$stmt_reagent = "";

			if($reagent!="")
			{
				$stmt_reagent = " AND `agent_id` LIKE '%".$reagent."%'";
			}

			// $stmt_reamount = "";

			// if($reamount!="")
			// {
			// 	$stmt_reamount = " AND `amount` LIKE '%".$reamount."%'";
			// }

			if($stmt_insert = $this->con->prepare("SELECT `id`, `ticket_id`, `agent_id`, `amount`, `status`, `message`, `date`, `time` FROM `refund_reuests` WHERE `agent_id`=? AND `status`='Pending' AND (`date` between ? AND ?)" .$stmt_reamount.$stmt_reagent))
				
				{
					$stmt_insert->bind_param("sss",$current_login_admin,$refrom_date,$reto_date);
					$stmt_insert->bind_result($id,$ticket_id,$agent_id,$amount,$status,$message,$date,$time);
				
				if($stmt_insert->execute())
				{
					$counter	=	0;
					$details	=	array();
					while($stmt_insert->fetch())
					{
						$details[$counter][0]	=	$id;
						$details[$counter][1]	=	$ticket_id;
						$details[$counter][2]	=	$agent_id;
						$details[$counter][3]	=	$amount;
						$details[$counter][4]	=	$status;
						$details[$counter][5]	=	$message;
						$details[$counter][6]	=	$date;
						$details[$counter][7]	=	$time;
					
					
						$counter++;
					}
					if(!empty($details))	
					{
						return $details;
					}
					return false;
				}	
			}
		}


function get_all_flight_booking_for_agent_for_refund_for_search($current_login_admin,$bfrom_date,$bto_date,$bfrom_loc,$bto_loc,$bstatus,$bcustomer_name)
		
		{
			$from_location_stmt = "";

			if($bfrom_loc!="")
			{
				$from_location_stmt = " AND `from_location` LIKE '%".$bfrom_loc."%'";
			}

			
			$to_location_stmt = "";

			if($bto_loc!="")
			{
				$to_location_stmt = " AND `to_location` LIKE '%".$bto_loc."%'";
			}

			$status_stmt = "";

			if($bstatus!="Select" AND $bstatus!="")
			{
				$status_stmt = " AND `ticket_status`= '".$bstatus."'";
			}

			$customer_name_statement = "";

			if($bcustomer_name!="")
			{
				$customer_name_statement = " AND `first_name` LIKE '%".$bcustomer_name."%'";
			}

			if($stmt_insert = $this->con->prepare("SELECT `id`, `transaction_id`, `booking_type`, `agent_id`, `from_location`, `to_location`, `travel_date`, `pax_size`, `tour_code`, `traveller_type`, `salutation`, `first_name`, `last_name`, `birth_dd`, `birth_mm`, `birth_year`, `ticket_status`, `ticket_amount`, `total_amount`, `commission`, `other_1`, `other_2`, `other_3`, `date`, `time`, `booking_id`, `pnr_no`, `flight_no`, `arrival_time`, `departure_time` FROM `flight_booking` WHERE `agent_id`=? AND (`date` between ? AND ?)" .$from_location_stmt.$to_location_stmt.$status_stmt .$customer_name_statement))
			{	
				$stmt_insert->bind_param("sss",$current_login_admin,$bfrom_date,$bto_date);
				$stmt_insert->bind_result($id,$transaction_id,$booking_type,$agent_id,$from_location,$to_location,$travel_date,$pax_size,$tour_code,$traveller_type,$salutation,$first_name,$last_name,$birth_dd,$birth_mm,$birth_year,$ticket_status,$ticket_amount,$total_amount,$commission,$other_1,$other_2,$other_3,$date,$time,$booking_id,$pnr_no,$flight_no,$arrival_time,$departure_time);
				
				if($stmt_insert->execute())
				{
					$counter	=	0;
					$details	=	array();
					while($stmt_insert->fetch())
					{
						
						$details[$counter][0]	=	$id;
						$details[$counter][1]	=	$transaction_id;
						$details[$counter][2]	=	$booking_type;
						$details[$counter][3]	=	$agent_id;
						$details[$counter][4]	=	$from_location;
						$details[$counter][5]	=	$to_location;
						$details[$counter][6]	=	$travel_date;	
						$details[$counter][7]	=	$pax_size;
						$details[$counter][8]	=	$tour_code;
						$details[$counter][9]	=	$traveller_type;
						$details[$counter][10]	=	$salutation;
						$details[$counter][11]	=	$first_name;
						$details[$counter][12]	=	$last_name;
						$details[$counter][13]	=	$birth_dd;
						$details[$counter][14]	=	$birth_mm;
						$details[$counter][15]	=	$birth_year;
						$details[$counter][16]	=	$ticket_status;
						$details[$counter][17]	=	$ticket_amount;
						$details[$counter][18]	=	$total_amount;
						$details[$counter][19]	=	$commission;
						$details[$counter][20]	=	$other_1;
						$details[$counter][21]	=	$other_2;
						$details[$counter][22]	=	$other_3;
						$details[$counter][23]	=	$date;
						$details[$counter][24]	=	$time;	

						$details[$counter][25]	=	$booking_id;	
						$details[$counter][26]	=	$pnr_no;	
						$details[$counter][27]	=	$flight_no;	
						$details[$counter][28]	=	$arrival_time;	
						$details[$counter][29]	=	$departure_time;							
					
						$counter++;
					}
					if(!empty($details))	
					{
						return $details;
					}
					return false;
				}	
			}
		}
		
		
function get_all_refund_request_for_agent_approved_for_filter($current_login_admin,$apfrom_date,$apto_date,$apamount,$apagent)
		{
			$stmt_apamount = "";

			if($apamount!="")
			{
				$stmt_apamount = " AND `amount` LIKE '%".$apamount."%'";
			}


			$stmt_apagent = "";

			if($apagent!="")
			{
				$stmt_apagent = " AND `agent_id` LIKE '%".$apagent."%'";
			}

			
			if($stmt_insert = $this->con->prepare("SELECT `id`, `ticket_id`, `agent_id`, `amount`, `status`, `message`, `date`, `time` FROM `refund_reuests` WHERE `agent_id`=? AND `status`='Active' AND (`date` between ? AND ?)".$stmt_apamount.$stmt_apagent))
				
				{
					$stmt_insert->bind_param("sss",$current_login_admin,$apfrom_date,$apto_date);
					$stmt_insert->bind_result($id,$ticket_id,$agent_id,$amount,$status,$message,$date,$time);
				
				if($stmt_insert->execute())
				{
					$counter	=	0;
					$details	=	array();
					while($stmt_insert->fetch())
					{
						$details[$counter][0]	=	$id;
						$details[$counter][1]	=	$ticket_id;
						$details[$counter][2]	=	$agent_id;
						$details[$counter][3]	=	$amount;
						$details[$counter][4]	=	$status;
						$details[$counter][5]	=	$message;
						$details[$counter][6]	=	$date;
						$details[$counter][7]	=	$time;
					
					
						$counter++;
					}
					if(!empty($details))	
					{
						return $details;
					}
					return false;
				}	
			}
		}

	function get_wallet_blanace_for_header($current_login_admin_code)
		{
			if($stmt_select = $this->con->prepare("Select `wallet_balance` from `register` where `phone_number` = ? "))
			{
				$stmt_select->bind_param("s",$current_login_admin_code);
			
				$stmt_select->bind_result($res_wallet_bal);
			
				if($stmt_select->execute())
				{
					if($stmt_select->fetch())
					{
						return $res_wallet_bal;
					}
				}
				return false;
			}
		}
		
		
			function get_commision_amount()
		{
			if($stmt_select = $this->con->prepare("Select `amount` from `add_prise` "))
			{
			    
				$stmt_select->bind_result($res_bal);
			
				if($stmt_select->execute())
				{
					if($stmt_select->fetch())
					{
						return $res_bal;
					}
				}
				return false;
			}
		}
		    
		
		
		

		function date_exist_amount()
	{
		// $date= date("Y-m-d");
		if($stmt_select = $this->con->prepare("SELECT  `id`  FROM `add_prise` "))
		{	
			// $stmt_select->bind_param("s",$data);

			$stmt_select->bind_result($id);

			if($stmt_select->execute())
			{
				if($stmt_select->fetch())
				{
					return $id;
				}
			}
					return false;
		}
	}
	
	
	function add_amount($amount)
	{							
		$date = date("Y-m-d");
		$time = date("H-i-s A");
		if($stmt_insert = $this->con->prepare("INSERT INTO `add_prise`(`amount`, `date`, `time`) VALUES (?,?,?)"))
		{
			$stmt_insert->bind_param("sss",$amount,$date,$time);
			
			if($stmt_insert->execute())
			{
				return true;
			}
				return false;
		} 	
	}
	
	function add_set_amount($amount)
	{							
		$date = date("Y-m-d");
		$time = date("H-i-s A");
		if($stmt_insert = $this->con->prepare("UPDATE `add_prise` SET `amount`=?,`date`=?,`time`=?"))
		{
			$stmt_insert->bind_param("sss",$amount,$date,$time);
			
			if($stmt_insert->execute())
			{
				return true;
			}
				return false;
		} 	
	}
function get_agent_name($agent_id)
		{
			if($stmt_select = $this->con->prepare("Select `full_name` from `register` where `phone_number` = ? "))
			{
				$stmt_select->bind_param("s",$agent_id);
			
				$stmt_select->bind_result($result_a);
			
				if($stmt_select->execute())
				{
					if($stmt_select->fetch())
					{
						return $result_a;
					}
				}
				return false;
			}
		}

function get_agent_email($agent_id)
		{
			if($stmt_select = $this->con->prepare("Select `email_address` from `register` where `phone_number` = ? "))
			{
				$stmt_select->bind_param("s",$agent_id);
			
				$stmt_select->bind_result($result_a);
			
				if($stmt_select->execute())
				{
					if($stmt_select->fetch())
					{
						return $result_a;
					}
				}
				return false;
			}
		}
		function get_agent_addr($agent_id)
		{
			if($stmt_select = $this->con->prepare("Select `address` from `register` where `phone_number` = ? "))
			{
				$stmt_select->bind_param("s",$agent_id);
			
				$stmt_select->bind_result($result_a);
			
				if($stmt_select->execute())
				{
					if($stmt_select->fetch())
					{
						return $result_a;
					}
				}
				return false;
			}
		}
		function get_emp_code_exist_from_agent1($select_api_c)
		{
			if($stmt_select = $this->con->prepare("Select `select_api_c` from `login_to_api` where `user_id` = ? "))
			{
				$stmt_select->bind_param("s",$select_api_c);
			
				$stmt_select->bind_result($result_id);
			
				if($stmt_select->execute())
				{
					if($stmt_select->fetch())
					{
						return $result_id;
					}
				}
				return false;
			}
		}
		
		function add_login_to_api($select_api_c,$user_id,$password,$response_token,$response_token_type,$response_agency_id,$response_agency_name,$response_contact_person,$response_city	,$response_country,$response_balance,$response_email_id,$response_mobile_no,$response_expiration)
		
		{
			$date = date("Y-m-d");
			$time = date("H-i-s A");
			
			if($stmt_insert = $this->con->prepare("INSERT INTO `login_to_api`(`select_api_c`, `user_id`, `password`, `token`, `token_type`, `agency_id`, `agency_name`, `contact_person`, `city`, `country`, `balance`, `email_id`, `mobile_no`, `expiration`, `date`, `time`) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"))
			{
				$stmt_insert->bind_param("ssssssssssssssss",$select_api_c,$user_id,$password,$response_token,$response_token_type,$response_agency_id,$response_agency_name,$response_contact_person,$response_city	,$response_country,$response_balance,$response_email_id,$response_mobile_no,$response_expiration,$date,$time);
				
				if($stmt_insert->execute())
				{
					return $stmt_insert->insert_id;
				}
				else
				{
				    echo $stmt_insert->error;
				}
					return false;
			} 	
		}
		
		function update_login_api($select_api_c, $user_id, $password, $response_token, $response_token_type, $response_agency_id, $response_agency_name, $response_contact_person, $response_city, $response_country, $response_balance, $response_email_id, $response_mobile_no, $response_expiration, $receipt_id)
        {
            $date = date("Y-m-d");
            $time = date("H-i-s A");
            
            if($stmt_insert = $this->con->prepare("UPDATE `login_to_api` SET `select_api_c`=?,`user_id`=?,`password`=?,`token`=?,`token_type`=?,`agency_id`=?,`agency_name`=?,`contact_person`=?,`city`=?,`country`=?,`balance`=?,`email_id`=?,`mobile_no`=?,`expiration`=?,`date`=?,`time`=? WHERE `id`=?"))
            {
                $stmt_insert->bind_param("ssssssssssssssssi", $select_api_c, $user_id, $password, $response_token, $response_token_type, $response_agency_id, $response_agency_name, $response_contact_person, $response_city, $response_country, $response_balance, $response_email_id, $response_mobile_no, $response_expiration, $date, $time, $receipt_id);
                
                if($stmt_insert->execute())
                {
                    return true;
                }
                return false;
            }   
        }
        function get_wallet_blanace_for_admin()
		{
			if($stmt_select = $this->con->prepare("Select `balance` from `login_to_api` ORDER BY `id` DESC limit 1"))
			{
			
				$stmt_select->bind_result($res_wallet_bal);
			
				if($stmt_select->execute())
				{
					if($stmt_select->fetch())
					{
						return $res_wallet_bal;
					}
				}
				return false;
			}
		}
		
		function get_last_token_entry_from_api_login($api_type)
		{
			if($stmt_select = $this->con->prepare("Select `token` from `login_to_api` where `select_api_c`='$api_type' ORDER BY `id` DESC limit 1"))
			{
				$stmt_select->bind_result($res_wallet_bal);
			
				if($stmt_select->execute())
				{
					if($stmt_select->fetch())
					{
						return $res_wallet_bal;
					}
				}
				return false;
			}
		}
		
function get_all_register_for_search12($agent_name)
{
    $agent_name_stmt = "";

    if ($agent_name != "") {
        $agent_name_stmt = " AND `full_name` LIKE '%" . $this->con->real_escape_string($agent_name) . "%'";
    }

    $query = "SELECT `id`, `company_name`, `full_name`, `phone_number`, `whatsapp_number`, `email_address`, `referred_by`, `country`, `state`, `district`, `city`, `address`, `pin_code`, `status`, `your_locailty`, `nearest_airport`, `primary_business`, `monthly_busines`, `secondary_business`, `monthly_business`, `pan_no`, `company_gst_no`, `online_ota_1`, `online_ota_2`, `series_ota_1`, `series_ota_2`, `password`, `date`, `time`, `wallet_balance` FROM `register` WHERE `status` = 'Active'" . $agent_name_stmt;

    if ($stmt_insert = $this->con->prepare($query)) {
        $stmt_insert->bind_result($id, $company_name, $full_name, $phone_number, $whatsapp_number, $email_address, $referred_by, $country, $state, $district, $city, $address, $pin_code, $status, $your_locailty, $nearest_airport, $primary_business, $monthly_busines, $secondary_business, $monthly_business, $pan_no, $company_gst_no, $online_ota_1, $online_ota_2, $series_ota_1, $series_ota_2, $password, $date, $time, $wallet_balance);
        
        if ($stmt_insert->execute()) {
            $counter = 0;
            $details = array();
            while ($stmt_insert->fetch()) {
                $details[$counter][0] = $id;
                $details[$counter][1] = $company_name;
                $details[$counter][2] = $full_name;
                $details[$counter][3] = $phone_number;
                $details[$counter][4] = $whatsapp_number;
                $details[$counter][5] = $email_address;
                $details[$counter][6] = $referred_by;
                $details[$counter][7] = $country;
                $details[$counter][8] = $state;
                $details[$counter][9] = $district;
                $details[$counter][10] = $city;
                $details[$counter][11] = $address;
                $details[$counter][12] = $pin_code;
                $details[$counter][13] = $status;
                $details[$counter][14] = $your_locailty;
                $details[$counter][15] = $nearest_airport;
                $details[$counter][16] = $primary_business;
                $details[$counter][17] = $monthly_busines;
                $details[$counter][18] = $secondary_business;
                $details[$counter][19] = $monthly_business;
                $details[$counter][20] = $pan_no;
                $details[$counter][21] = $company_gst_no;
                $details[$counter][22] = $online_ota_1;
                $details[$counter][23] = $online_ota_2;
                $details[$counter][24] = $series_ota_1;
                $details[$counter][25] = $series_ota_2;
                $details[$counter][26] = $password;
                $details[$counter][27] = $date;
                $details[$counter][28] = $time;
                $details[$counter][29] = $wallet_balance;
                
                $counter++;
            }

            if (!empty($details)) {
                return $details;
            }
            return false;
        }
    }
}


function get_last_user_data()
{
    if ($stmt_select = $this->con->prepare("SELECT `user_id`, `password` FROM `login_to_api` ORDER BY `id` DESC LIMIT 1")) {
        if ($stmt_select->execute()) {
            $stmt_select->bind_result($res_user_id, $res_password);
            if ($stmt_select->fetch()) {
                return ['user_id' => $res_user_id, 'password' => $res_password];
            }
        }
        $stmt_select->close();
    }
    return false;
}



function insert_available_sector($sector_name,$origin,$destination,$other)
		{
			$date = date("Y-m-d");
			$time = date("H-i-s A");
			
			if($stmt_insert = $this->con->prepare("INSERT INTO `available_sector`(`sector_name`, `origin`, `destination`, `other`, `date`, `time`) VALUES (?,?,?,?,?,?)"))
			{
				$stmt_insert->bind_param("ssssss",$sector_name,$origin,$destination,$other,$date,$time);
				
				if($stmt_insert->execute())
				{
					return true;
				}
					return false;
			} 	
		}
function get_available_sector()
		{
			if($stmt_insert = $this->con->prepare("SELECT `id`, `sector_name`, `origin`, `destination`, `other`, `date`, `time` FROM `available_sector` "))
				{
					$stmt_insert->bind_result($id,$sector_name,$origin,$destination,$other,$date,$time);
				
				if($stmt_insert->execute())
				{
					$counter	=	0;
					$details	=	array();
					while($stmt_insert->fetch())
					{
						$details[$counter][0]	=	$id;
						$details[$counter][1]	=	$sector_name;
						$details[$counter][2]	=	$origin;
						$details[$counter][3]	=	$destination;
						$details[$counter][4]	=	$other;
						$details[$counter][5]	=	$date;
						$details[$counter][6]	=	$time;
					
					
						$counter++;
					}
					if(!empty($details))	
					{
						return $details;
					}
					return false;
				}	
			}

		}
		
		function get_available_sector_distinct()
		{
			if($stmt_insert = $this->con->prepare("SELECT `sector_name`, `origin` FROM `available_sector` "))
				{
					$stmt_insert->bind_result($sector_name,$origin);
				
				if($stmt_insert->execute())
				{
					$counter	=	0;
					$details	=	array();
					while($stmt_insert->fetch())
					{
						$details[$counter][0]	=	$sector_name;
						$details[$counter][1]	=	$origin;

						$counter++;
					}
					if(!empty($details))	
					{
						return $details;
					}
					return false;
				}	
			}

		}
		
		function get_available_sector_by_select_origin($selected_origin)
		{
			if($stmt_insert = $this->con->prepare("SELECT `sector_name`, `destination` FROM `available_sector` where `origin`=?"))
				{
				    $stmt_insert->bind_param("s",$selected_origin);
				    
					$stmt_insert->bind_result($sector_name,$destination);
				
				if($stmt_insert->execute())
				{
					$counter	=	0;
					$details	=	array();
					while($stmt_insert->fetch())
					{
					    $disply_sector_position = strpos($sector_name,"//");
					    $total_length_of_sector = strlen($sector_name);
						$disply_sector_name     = substr($sector_name,$disply_sector_position+2,$total_length_of_sector);
									    
						$details[$counter][0]	=	trim($disply_sector_name);
						$details[$counter][1]	=	$destination;

						$counter++;
					}
					if(!empty($details))	
					{
						return $details;
					}
					return false;
				}	
			}

		}

function delete_available_sector()
{
    if ($stmt_select = $this->con->prepare("DELETE FROM `available_sector`")) {
        if ($stmt_select->execute()) {
            $stmt_select->close();
            return true;
        }
        $stmt_select->close();
        return false;
    }
    return false;
}

function get_all_flight_data_by_prn($prn_no)
{
    $prn_no_stmt = "";
    $booking_id_stmt = "";

    if ($prn_no != "") {
        $prn_no_stmt = "WHERE `pnr_no` LIKE '%" . $prn_no . "%'";
        $booking_id_stmt = " OR `booking_id` LIKE '%" . $prn_no . "%'";
    }

    if ($stmt_insert = $this->con->prepare("SELECT `id`, `transaction_id`, `booking_type`, `agent_id`, `from_location`, `to_location`, `travel_date`, `pax_size`, `tour_code`, `traveller_type`, `salutation`, `first_name`, `last_name`, `birth_dd`, `birth_mm`, `birth_year`, `ticket_status`, `ticket_amount`, `total_amount`, `commission`, `other_1`, `other_2`, `other_3`, `date`, `time`, `booking_id`, `pnr_no`, `flight_no`, `arrival_time`, `departure_time` FROM `flight_booking` " . $prn_no_stmt . $booking_id_stmt))
    {   
        $stmt_insert->bind_result($id,$transaction_id,$booking_type,$agent_id,$from_location,$to_location,$travel_date,$pax_size,$tour_code,$traveller_type,$salutation,$first_name,$last_name,$birth_dd,$birth_mm,$birth_year,$ticket_status,$ticket_amount,$total_amount,$commission,$other_1,$other_2,$other_3,$date,$time,$booking_id,$pnr_no,$flight_no,$arrival_time,$departure_time);
        
        if ($stmt_insert->execute())
        {
            $counter = 0;
            $details = array();
            while ($stmt_insert->fetch())
            {
                $details[$counter][0] = $id;
                $details[$counter][1] = $transaction_id;
                $details[$counter][2] = $booking_type;
                $details[$counter][3] = $agent_id;
                $details[$counter][4] = $from_location;
                $details[$counter][5] = $to_location;
                $details[$counter][6] = $travel_date;
                $details[$counter][7] = $pax_size;
                $details[$counter][8] = $tour_code;
                $details[$counter][9] = $traveller_type;
                $details[$counter][10] = $salutation;
                $details[$counter][11] = $first_name;
                $details[$counter][12] = $last_name;
                $details[$counter][13] = $birth_dd;
                $details[$counter][14] = $birth_mm;
                $details[$counter][15] = $birth_year;
                $details[$counter][16] = $ticket_status;
                $details[$counter][17] = $ticket_amount;
                $details[$counter][18] = $total_amount;
                $details[$counter][19] = $commission;
                $details[$counter][20] = $other_1;
                $details[$counter][21] = $other_2;
                $details[$counter][22] = $other_3;
                $details[$counter][23] = $date;
                $details[$counter][24] = $time;
                $details[$counter][25] = $booking_id;
                $details[$counter][26] = $pnr_no;
                $details[$counter][27] = $flight_no;
                $details[$counter][28] = $arrival_time;
                $details[$counter][29] = $departure_time;

                $counter++;
            }
            if (!empty($details)) {
                return $details;
            }
            return false;
        }   
    }
}


            function add_expenses_for_staff($expenses,$amount,$added_by,$description,$title)
			{							
				$date = date("Y-m-d");
				$time = date("H-i-s A");
				if($stmt_insert = $this->con->prepare("INSERT INTO `expenses_mgt`(`expenses`, `amount`, `date`, `time`, `added_by`, `description`, `title`) VALUES (?,?,?,?,?,?,?)"))
				{
					$stmt_insert->bind_param("sssssss",$expenses,$amount,$date,$time,$added_by,$description,$title);
					
					if($stmt_insert->execute())
					{
						return true;
					}
						return false;
				} 	
			}
			
			function delete_expenses_staff($del_id)
			{
				if($stmt_select = $this->con->prepare("Delete from `expenses_mgt` where `id`=?"))
				{
					$stmt_select->bind_param("i",$del_id);
				
					if($stmt_select->execute())
					{					
							return true;
					}
						return false;
				}
			}
			
				function get_item_master_name_category()
			{	
				if($stmt_insert = $this->con->prepare("SELECT `id`, `expenses_name` FROM `expenses_category` "))
				{	
					$stmt_insert->bind_result($id,$name);
					
					if($stmt_insert->execute())
					{
							$counter	=	0;
							$details	=	array();
						while($stmt_insert->fetch())
						{
							$details[$counter][0]	=	$id;
							$details[$counter][1]	=	$name;


							$counter++;
						}
						if(!empty($details))	
						{
							return $details;
						}
						return false;
					}	
				}
			}
			
			function get_all_expenses_for_admin($efrom_date,$eto_date)
			{
				// Initialize details as an empty array to ensure a consistent return type
				$details = array(); 
			
				// Prepare the SQL statement	
				if ($stmt_insert = $this->con->prepare("SELECT `id`, `expenses`, `amount`, `date`, `description`, `title` FROM `expenses_mgt` where (`date` between ? AND ?)")) {
					// Bind result variables
					$stmt_insert->bind_param("ss",$efrom_date,$eto_date);
					$stmt_insert->bind_result($id, $expenses, $amount, $date, $description, $title);
			
					// Execute the statement
					if ($stmt_insert->execute()) {
						// Fetch the results into the details array
						$counter = 0;
						while ($stmt_insert->fetch()) {
							$details[$counter][0] = $id;
							$details[$counter][1] = $expenses;
							$details[$counter][2] = $amount;
							$details[$counter][3] = $date;
							$details[$counter][4] = $description;
							$details[$counter][5] = $title;
							
							$counter++;
						}
					} else {
						// Handle execution failure
						error_log("Error executing the statement: " . $stmt_insert->error);
					}
			
					// Close the statement
					$stmt_insert->close();
				} else {
					// Handle preparation failure
					error_log("Error preparing the statement: " . $this->con->error);
				}
			
				// Return the details array, even if empty
				return $details;
			}
			
			function fetch_item_name($id)
			{
				if($stmt_select = $this->con->prepare("Select `expenses_name` from `expenses_category` where `id` = ? "))
				{	
					$stmt_select->bind_param("i",$id);
				
					$stmt_select->bind_result($result_service);
					
					if($stmt_select->execute())
					{
						if($stmt_select->fetch())
						{
							 return $result_service;
						}
					}
							return false;
				}
			}
			function fetch_exepense_data_for_staff($id)
			{	
				if($stmt_insert = $this->con->prepare("SELECT `id`, `expenses`, `amount`, `date`,`description`,`title` FROM `expenses_mgt` WHERE `id` = ?"))
				{	
					$stmt_insert->bind_param("i",$id);
					
					$stmt_insert->bind_result($id,$expenses,$amount,$date,$description,$title);

					if($stmt_insert->execute())
					{
							$counter	=	0;
							$details	=	array();
						while($stmt_insert->fetch())
						{
							$details[$counter][0]	=	$id;
							$details[$counter][1]	=	$expenses;
							$details[$counter][2]	=	$amount;
							$details[$counter][3]	=	$date;
							$details[$counter][4]	=	$description;
							$details[$counter][5]	=	$title;
							$counter++;
						}
						if(!empty($details))	
						{
							return $details;
						}
						return false;
					}	
				}
			}
			
			function expenses_update_data($update_id,$expenses,$amount,$description,$title)
			{
				$date = date("Y-m-d");
				$time = date("H:i:s A");
						
				if($stmt_select = $this->con->prepare("update `expenses_mgt` set `expenses`= ?,`amount`= ?,`description`= ?,`title`= ? where `id` = ?"))
				{
					$stmt_select->bind_param("ssssi",$expenses,$amount,$description,$title,$update_id);				
							
					if($stmt_select->execute())
					{					
						return true;
					}
						return false;
				}
				
			}


	}//End Of Class
?>

EliteHackz.ORG
Revonzy Mini Shell
root@revonzy.com

Linux 65-254-81-4.cprapid.com 5.14.0-284.11.1.el9_2.x86_64 #1 SMP PREEMPT_DYNAMIC Tue May 9 05:49:00 EDT 2023 x86_64
Apache
65.254.81.4