<?php 
if($_REQUEST['action']=='View')
{
	
    $getlead=DB_query( "select * from daily_visit_entry where id='".$_REQUEST['VisitId']."'",$db);
	 while($row_lead=DB_fetch_array($getlead))
	 {
	    $SrNo=$row_lead['SrNo'];
		$DailyVisitDate=ConvertSQLDate($row_lead['DailyVisitDate']);
  	     $EmpName=$row_lead['EmpName'];
		$Department=$row_lead['Department'];
		$Designation=$row_lead['Designation'];
		$Site=$row_lead['Site'];
	    $ClientName=$row_lead['ClientName'];
		$ClientLocation=$row_lead['ClientLocation'];
		$ClientCity=$row_lead['ClientCity'];
		$ContactPerson=$row_lead['ContactPerson'];
		$MobileNo=$row_lead['MobileNo'];
		$OfficeNo=$row_lead['OfficeNo'];
		
		
		$Email=$row_lead['Email'];
		$Website=$row_lead['Website'];
		$MeetingType=$row_lead['MeetingType'];
		$PurposeAssigned=$row_lead['PurposeAssigned'];
		$MeetingDes=$row_lead['MeetingDes'];
		$ExpenseFrom=ConvertSQLDate($row_lead['ExpenseFrom']);
		$ExpenseTo=ConvertSQLDate($row_lead['ExpenseTo']);
		$Mode=$row_lead['Mode'];
		$TotalKM=$row_lead['TotalKM'];
		$Rate=$row_lead['Rate'];
		$TotalTA=$row_lead['TotalTA'];
		$Fooding=$row_lead['Fooding'];
		$OtherCharges=$row_lead['OtherCharges'];
		$TotalAmt=$row_lead['TotalAmt'];
		$ReportTo=$row_lead['ReportTo'];
		$PaidStatus=$row_lead['PaidStatus'];
		$Narration=$row_lead['Narration'];
		
		}
}



?>



<script type="text/javascript">
function Cal_TotalTA()
{
	var KM= document.getElementById("KM").value;
	var Rate= document.getElementById("Rate").value;
	var TotalTa=parseFloat(KM)*parseFloat(Rate);
	document.getElementById("TotalTA").value=TotalTa;
	
}
function Cal_TotalAmt()
{
	var TotalTA= document.getElementById("TotalTA").value;
	var Fooding= document.getElementById("Fooding").value;
	var OtherCharges=document.getElementById("OtherCharges").value;
	var TotalAmt=parseFloat(TotalTA)+parseFloat(Fooding)+parseFloat(OtherCharges);
	document.getElementById("TotalAmt").value=TotalAmt;
	
}
</script>

<div style="width:800px; margin-right:auto; margin-left:auto;">
<fieldset style="margin:0px;text-align:left;">
<h2 align="center">DAILY FIELD MARKETING</h2>

<h3>General Info</h3>
	<!--Table 1 Start --><div>
	<form method="post" action="">
	<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <th width="11%">Sr No.</th>
   
    <td width="24%"><input name="SrNo" type="text" style="width:175px;"  value="<?php echo $SrNo;?>" readonly/></td>
    
    <th width="15%">Date</th>
    <td width="17%"><input type="text" style="width:130px;" name="DailyVisitDate"   value="<?php echo $DailyVisitDate;?>" readonly /></td>
    <th width="16%">Employee Name</th>
    <td width="17%">
    <?php 
    		$EmpSql="SELECT * FROM empmaster where id='".$EmpName."'";
			$EmpRes=DB_query($EmpSql,$db);
			$EmpRow=DB_fetch_array($EmpRes);
			
			
    		?>
			<input value="<?php echo $EmpRow['emp_name']?>" type="text" name="EmpName"  readonly>
			<?php ?>
			
	
	</select></td>
  </tr>
  <tr>
  	<td colspan="7" id="hid_EDetails">
  	<table width="100%" border="0">
  <tr>
  	 
  	<th width="11%">Dept.</th>
    <td width="24%">
   <?php $DepartmenName=$s->getField('deptmaster','deptcode',$Department,'deptname')?> 	
   <input type="text" name="Department" value="<?php echo $DepartmenName?>"style="width:175px;" readonly></td>
    <th width="15%">Designation</th>
    <td width="17%">
    	
    	
    	<?php $DesignationName=$s->getField('desigmaster','desigcode',$Designation,'designame'); ?>
    	<input type="text" name="Designation" value="<?php echo $DesignationName?> " style="width: 100%" readonly>
	</td>
    <th width="16%">Branch</th>
    <td width="17%">
    	<?php $BranchName=$s->getField('locations','loccode',$Site,'locationname');?><input type="text" name="Site" value="<?php echo $BranchName?>" style="width: 100%" readonly></td>
 </tr></table></td></tr>
  	
  	 	
  	
 
 

</table>
	</div><!--Table 6 Start -->



<h3 style="text-align:left;">Field Vist Report</h3>
	<!--Table 1 Start --><div>
	<table width="100%" border="0" cellspacing="1" cellpadding="2">
  <tr>
    <th width="21%">Client Name</th>
    <td width="17%"><input type="text" style="width:125px;" name="ClientName" value="<?php echo  $ClientName ?>" readonly />
</td>
    <th width="13%">Location</th>
    <td width="16%"><input type="text" style="width:125px;"  name="ClientLocation"  value="<?php echo $ClientLocation?>" readonly /></td>
    <th width="16%">City</th>
    <td width="17%"><input type="text" style="width:125px;" name="ClientCity"  value="<?php echo $ClientCity?>"  readonly /></td>
  </tr>

  <tr>
    <th width="21%">Contact Person</th>
    <td width="17%"><input type="text" style="width:125px;" name="ContactPerson"  value="<?php echo $ContactPerson?>"  readonly /></td>
    <th width="13%">Mob. No</th>
    <td width="16%"><input type="text" style="width:125px;" name="MobileNo"  value="<?php echo $MobileNo?>"  readonly /></td>
    <th width="16%">Off. No.</th>
    <td width="17%"><input type="text" style="width:125px;" name="OfficeNo"   value="<?php echo $OfficeNo?>" readonly /></td>
  </tr>
  <tr>
    <th width="21%">Email</th>
    <td width="17%"><input type="text" style="width:125px;" name="Email"  value="<?php echo $Email?>"  readonly /></td>
    <th width="13%">Website</th>
    <td width="16%"><input type="text" style="width:125px;"  name="Website"  value="<?php echo $Website?>"  readonly /></td>
    <th width="16%">Meeting Type</th>
    <?php 
    if($MeetingType=='S')
	{
		$MeetingType1="Successful";
		
	}
	elseif ($MeetingType=='H') {
		$MeetingType1="Hot";
	}
	else {
		$MeetingType1="Cold";
	}
    
    ?>
    
    
    
    <td width="17%"><input type="text"  name="MeetingType"  value="<?php echo $MeetingType1?>" readonly >
			
	
	</td>
  </tr>
  <tr>
    <th width="21%">Purpose Assigned</th>
    <td width="17%" colspan="5"><input type="text" style="width:485px;" name="PurposeAssigned"  value="<?php echo $PurposeAssigned?>"  readonly /></td>
  </tr>
	<tr>
    <th width="13%">Meeting Description</th>
    <td width="16%" colspan="5"><input type="text" style="width:485px;"  name="MeetingDes"  value="<?php echo  $MeetingDes?>" readonly /></td>
	</tr>

</table>
	</div><!--Table 2 Start -->
<h3 style="text-align:left;">Expense Information</h3>
	<!--Table 1 Start --><div>
	<table width="100%" border="0" cellspacing="1" cellpadding="2">
  <tr>
    <th width="21%">From</th>
    <td width="17%"><input type="text" style="width:125px;"   name="ExpenseFrom"  value="<?php echo $ExpenseFrom?>" readonly  />
</td>
    <th width="13%">To</th>
    <td width="16%"><input type="text" style="width:125px;"   name="ExpenseTo"   value="<?php echo  $ExpenseTo?>"  readonly /></td>
    <th width="16%">Mode</th>
    <td width="17%">
    	 <?php 
    if($Mode=='0')
	{
		$Mode1=" ";
		
	}
	elseif ($Mode=='B') {
		$Mode1="Bus";
	}
	elseif($Mode=='T')
	{
		$Mode1="Train";
	}
	else{
		$Mode1="Bike";
	}
    
    ?>
    	
    	
    	
    	
    	<input type="text"  name="Mode"  readonly="true"  value="<?php echo $Mode1?>"  >
			
	
	</td>
  </tr>

  <tr>
    <th width="21%">Total Km</th>
    <td width="17%"><input type="text" name="KM" id="KM" style="width:125px;"    value="<?php echo $TotalKM ?>" readonly /></td>
    <th width="13%">Rate/Unit</th>
    <td width="16%"><input type="text" style="width:125px;" name="Rate" id="Rate"  value="<?php echo $Rate?>"  readonly /></td>
    <th width="16%">Total Ta</th>
    <td width="17%"><input type="text" style="width:125px;" id="TotalTA"  name="TotalTA" value="<?php echo $TotalTA?>" readonly    /></td>
  </tr>
  <tr>
    <th width="21%">Fooding</th>
    <td width="17%"><input type="text" style="width:125px;"  name="Fooding"  id="Fooding"   value="<?php echo $Fooding?>" readonly /></td>
    <th width="13%">Other Charges</th>
    <td width="16%"><input type="text" style="width:125px;" name="OtherCharges" id="OtherCharges"  value="<?php echo $OtherCharges?>"  readonly /></td>
    <th width="16%">Total Amt</th>
    <td width="17%"><input type="text" style="width:125px;" name="TotalAmt" id="TotalAmt"   value="<?php echo $TotalAmt?>"   readonly  /></td>
  </tr>
  <tr>
    <th width="21%">Report To</th>
    <td width="17%" colspan="2"><input type="text"  name="ReportTo"   value="<?php echo $ReportTo?>" readonly >
			
	
	</td>
    <th width="13%">Paid Status</th>
    <td width="16%" colspan="2">
    	 <?php 
    if($PaidStatus=='0')
	{
		$PaidStatus1=" ";
		
	}
	elseif ($PaidStatus=='Y') {
		$PaidStatus1="Yes";
	}
	
	else{
		$PaidStatus1="No";
	}
    
    ?>
    	<input type="text" style="width:125px;"  name="PaidStatus"  value="<?php echo $PaidStatus1?>" readonly /></td>
  </tr>
  
  <tr>
    <th width="21%">Narration</th>
    <td width="17%" colspan="5"><input type="text" style="width:485px;" name="Narration"   value="<?php echo $Narration?>" readonly /></td>
  </tr>

</table>

	</div><!--Table 2 Start -->

	
	<br />
	
	<br />

</fieldset>
</div>

