<?php
		session_start();
		$cmpmid = $_SESSION['linkarisecmpmid'];	 
	include "connect.php";

	if (isset($_REQUEST['id'])) {
			
		$id = intval($_REQUEST['id']);
		
		$eve_category1="select * from res_invoice_master where invoicemid=$id";
		$re_category1 = mysqli_query($conn, $eve_category1);
?>
			
		<div class="table-responsive">
		<?php
			while($rt_category1 = mysqli_fetch_assoc($re_category1))
			{
				$partymid=$rt_category1['customermid'];
				
				$eve_category2="select * from res_party_master where partymid=$partymid";
		$re_category2 = mysqli_query($conn, $eve_category2);
				while($rt_category2 = mysqli_fetch_assoc($re_category2))
				{
					$email=$rt_category2['partyemail'];
				}
			}	
			$emailsubject="";
			$emailmsg="";
			$eve_setting="select * from res_company_master where cmpmid='$cmpmid'";
			$re_setting = mysqli_query($conn, $eve_setting);
			while($rt_setting = mysqli_fetch_assoc($re_setting))
			{
				$emailsubject=$rt_setting['invoiceemailsubject'];
				$emailmsg=$rt_setting['invoiceemailmsg'];
			}	
				$bcc='at.virendra@gmail.com';
				
				
			
		?>
		<table class="table table-striped table-bordered">
		 <tr id="email1">
			    <th>To </th>
				<td><input type="text" name="email1" class="form-control" placeholder="Enter Email" value="<?php echo $email;?>"></td>
			</tr>
			
			
			<tr id="cc1">
			    <th>CC </th>
				<td><input type="text" name="cc1" class="form-control" placeholder="Enter Email" ></td>
			</tr>
			
			<tr id="bcc1">
			    <th>BCC </th>
				<td><input type="text" name="bcc1" class="form-control" placeholder="Enter Email" value="<?php echo $bcc;?>"></td>
			</tr>
			
			<tr>
				<th>Email Subject</th>
				<td><input type="text" name="esubject" class="form-control" placeholder="Enter Email Subject" value="<?php echo $emailsubject;?>"></td>
			</tr>	
			<tr>
				<th>Email Message</th>
				<td>
					<textarea type="text" name="emessage" class="form-control" placeholder="Enter Email Message" rows="5"><?php echo $emailmsg;?></textarea></td>
			</tr>
			<tr>
				<th>Extra Attachment</th>
				<td><input type="file" name="file" class="form-control"></td>
			</tr>	
			
		</table>
			
		</div>
			
		<?php				
	}
	