<?php
session_start();

	if(!isset($_SESSION['linkarisecrm']))
	{
		header('Location: index.php');
		return;
	}
	date_default_timezone_set("Asia/Kolkata");
	 $mdate1= date('Y-m-d');
	 $mdatetime= date('Y-m-d H:i:s');
	 $cdatetime= date('Y-m-d H:i:s');

	$brmid=$_SESSION['lacrmbrmid'];
	$umid = $_SESSION['lacrmumid'];


	include("connect.php");

	
	 $invoicemid=$_POST['invoicemid'];
	

	  $inqfremarks=$_POST['reminderremarks'];
	  $newinqdate=date("Y-m-d", strtotime($_POST['reminderdate']));

    $followup=$_POST['reminder'];

	

	 
	$eve31 = "update res_invoice_master set paymentreminder='$followup',paymentreminderdate='',paymentreminderremarks='' where invoicemid='$invoicemid'";
	$re31 = mysqli_query($conn, $eve31);
		
	if($followup=='Yes')
	{
		 $eve1 = "update res_invoice_master set paymentreminderdate='$newinqdate',paymentreminderremarks='$inqfremarks' where invoicemid='$invoicemid'";
		 if ($conn->query($eve1) === TRUE)
		{
			$last_id = $conn->insert_id;
				
			$_SESSION['msg'] = "Payment Reminder Addded";
			

		}
		else
		{
			$_SESSION['msg1'] = "Payment Reminder Not Addded";
			
		}
	}
	
	 
	header("Location: paymentreminder.php"); 

?>
