<?php
include("common/connection.php");
//
/*echo $SqlUpdate=" allocation_master set 
								patient_name='".$_REQUEST['patient_name']."',
								doctor_name='".$_REQUEST['select_doctor']."',
								nurse_name='".$_REQUEST['select_nurse']."',
								visit_date='".$_REQUEST['visit_date']."',
								visit_time='".$_REQUEST['visit_time']."',
								price_discussion='".$_REQUEST['price_discussion']."', 
								price_agreed_uppon='".$_REQUEST['price_agreed_uppon']."' 
					where Lead_ID='".$_REQUEST['lead_id']."'";*/
 //Insert Data Into allocation master table// 
 $allocate=$_SESSION['user'];
 $sqlInsert ="INSERT INTO `allocation_master` (`sln` ,`Lead_ID`,`patient_name` ,`doctor_name` ,`nurse_name` ,`visit_date` ,`visit_time` ,`price_discussion`,`price_aggred_upon`,`allocated_by`,`allocation_time`)
			VALUES (NULL ,'".$_REQUEST['lead_id']."','".$_REQUEST['patient_name']."','".$_REQUEST['select_doctor']."','".$_REQUEST['select_nurse']."','".$_REQUEST['visit_date']."','".$_REQUEST['visit_time']."','".$_REQUEST['price_discussion']."','".$_REQUEST['price_aggred_upon']."','".$allocate."','".date('Y-m-d,h.i.s')."')";
 mysqli_query($con,$sqlInsert);

$SqlUpdate="update lead_master set date_of_allocation='".date('Y-m-d')."',Allocated='1', Allocated_Doctor='".$_REQUEST['select_doctor']."',Allocated_Nurse='".$_REQUEST['select_nurse']."' where Lead_ID='".$_REQUEST['lead_id']."'";
mysqli_query($con,$SqlUpdate);

$contact="insert into `lead_contact_details` (`Lead_ID`,`Patient_Name`,`Patient_Address1`,`Patient_Address2`,`Patient_City`,`Patient_State`,`Patient_Pincode`,`Contactperson_Name`,`Contactperson_Phno`,`Patient_Age`,`Patient_Gender`,`Relationship`,`Contact_Person_Email`) values ('".$_REQUEST['lead_id']."','".$_REQUEST['patient_name']."','".$_REQUEST['patient_address1']."','".$_REQUEST['patient_address2']."','".$_REQUEST['patient_city']."','".$_REQUEST['patient_state']."','".$_REQUEST['patient_pincode']."','".$_REQUEST['contact_person_name']."','".$_REQUEST['contact_person_ph']."','".$_REQUEST['age']."','".$_REQUEST['gender']."','".$_REQUEST['relation']."','".$_REQUEST['Contact_Person_Email']."')";
mysqli_query($con,$contact);
?>