<?php
include("common/connection.php");


?>
<!doctype html>
<html class="no-js" lang="en">

<head>
    <meta charset="utf-8">
    <meta http-equiv="x-ua-compatible" content="ie=edge">
    <title>View Service | Buurtzorg</title>
    <?php include("headerlink.php"); ?> 
    
    
   
    
    
    
    <link rel="stylesheet" href="css/data-table/bootstrap-table.css">
    	<link rel="stylesheet" href="css/data-table/bootstrap-editable.css">
        
        
        <style>
		table {overflow:inherit !important}
		table thead {overflow:inherit !important}
		table thead tr {overflow:inherit !important; }
		
		table tbody {overflow:inherit !important}
		table tbody tr {overflow:inherit !important; }
		table tbody tr td {overflow:inherit !important}
		
		
		.fixed-table-body {overflow:inherit !important}
		.action_dropdown {padding:0 !important; min-width:460px !important;  left:-258px; background-color:rgba(0,0,0,0) !important;
		 box-shadow:none !important; border:none !important; margin-top:-70px}
										
		 .action_dropdown:after {
			  content:'';
			  width: 0;
			  height: 0;
			  border-left: 7px solid transparent;
			  border-right: 7px solid transparent;
			  border-top: 12px solid #337ab7;
			  margin-top:40px;
			  position:absolute;
			  top:-10px;
			  margin-left:-190px;
		}
		
		
		
		
		</style>
    
    <?php
	//------------- Patient ID -------------//
/* $seq_sln_sql="select max(SLN) as total_leads from patient_master ";
	$seq_sln_qry=mysqli_query($con,$seq_sln_sql);
	$seq_sln=mysqli_fetch_array($seq_sln_qry);
    $Max_Sln=$seq_sln['total_leads']; 

		if($seq_sln['total_leads']!='')
		{			 
		    
			$Sql_PrjId="Select * From patient_master Where SLN='".$Max_Sln."'";
			$Qry_PrjId=mysqli_query($con,$Sql_PrjId);
			$Result_PrjId=mysqli_fetch_array($Qry_PrjId);
			$Max_PrjId=$Result_PrjId['Patient_Id'];
			$Id=explode("PID",$Max_PrjId);
			$New_PrjId=$Id[1]+1;								
			$Cln_Id="PID".$New_PrjId; 
		}
		else
		{
			$Cln_Id="PID10001";
		}*/

	//------------- Patient ID -------------//
		?>
    
    
    
     <link rel="stylesheet" href="css/form/all-type-forms.css">
    <!-- x-editor CSS
		============================================ -->
    <link rel="stylesheet" href="css/editor/select2.css">
    <link rel="stylesheet" href="css/editor/datetimepicker.css">
    <link rel="stylesheet" href="css/editor/bootstrap-editable.css">
    <link rel="stylesheet" href="css/editor/x-editor-style.css">

</head>

<body onLoad="showbutton('<?php echo $Lead_Va_Id; ?>')">
 <?php 
  if (isset($_REQUEST['submit']))
  	{ 
	
		
		$CheckPatientMaster=mysqli_num_rows(mysqli_query($con,"select SLN from patient_agreement where Lead_ID='".base64_decode($_REQUEST['Lid'])."' and Status='0'")); 
		  
		  if($CheckPatientMaster>0)
			{
		  
			$update_master="update patient_agreement set Status='1' where Lead_ID='".base64_decode($_REQUEST['Lid'])."'";
           mysqli_query($con,$update_master);
		   $fetch_id=mysqli_fetch_array(mysqli_query($con,"Select Patient_Id from patient_master where Lead_ID='".base64_decode($_REQUEST['Lid'])."'"));

            $update_roster=mysqli_query($con,"update roster_master set Active='1' where Treatment_Service_Date>'".date('Y-m-d')."' and Patient_Id='".$fetch_id['Patient_Id']."'");
		   }
		   else
		   {
			   $UpdatePatMas="update patient_agreement set Status='0' where Lead_ID='".base64_decode($_REQUEST['Lid'])."'";
				 mysqli_query($con,$UpdatePatMas);
				 //NewLead($con,$_REQUEST['Patient_Name']);
				 $fetch_id=mysqli_fetch_array(mysqli_query($con,"Select Patient_Id from patient_master where Lead_ID='".base64_decode($_REQUEST['Lid'])."'"));

           $update_roster=mysqli_query($con,"update roster_master set Active='0' where Treatment_Service_Date>'".date('Y-m-d')."' and Patient_Id='".$fetch_id['Patient_Id']."'");
		   }
		?>
        <script>
     			alert('Agreement Pause Successsfully');
						setTimeout( function() {
			
						window.parent.location.href="Live_Agreement.php";
						},500);
     		</script>
        <?php
		}
		
		 //$FetchPatientMaster=FetchData($con,'lead_contact_details','Lead_ID',$_REQUEST['Lid']);
		   //query for lead_contact_details//
		   $fetch="select * from lead_contact_details where Lead_ID='".$Lead_Va_Id."'";
		   $fetch_query=mysqli_query($con,$fetch);
		   $fetch_fetch=mysqli_fetch_array($fetch_query);
		   //patient_agreement//
		   $fetch2="select * from lead_master where Lead_ID='".$Lead_Va_Id."'";
		   $fetch2_query=mysqli_query($con,$fetch2);
		   $fetch_fetch2=mysqli_fetch_array($fetch2_query)
		?>
        <br />
        <br />
	<div style="text-align:center;">
    <h4>Please Give Reason for Pause Agreement</h4>
    </div>
    <br />
    <form  name="Product" method="post"  enctype="multipart/form-data" onSubmit="return ValidateProduct()" style="text-align:center;">
    <div id="prnt_btn">
    <textarea id="reason" name="reason" class="form-data" width="100%"></textarea><br>
	
	<input type="submit" value="Submit" name="submit" id="submit" class="btn btn-Primary" >
    
    </form>
    <span style="color:#FF0000;  font-size:12px; text-align:center; display:block"><?php echo $msg;?></span>
   	 
    </div>   
       
       
       </body>

</html>