<?php
$PageSecurity = 1;
include('includes/DefinePaymentClass.php');
$title = _('Invoice');
include('includes/SQL_CommonFunctions.inc');
?>
<h2 align="center">SaleExecutive Master</h2>
 <?php
if($_REQUEST['action']=='delete')
{
    $delsql = "delete from  salesman_master where id='".$_REQUEST['id']."'";
   $delete_result = DB_query($delsql,$db);
    if(!$delete_result)
  {
    die("error".DB_error_msg($db));
   }
  $s->pageLocation('index.php?route=View_SalesManMaster&modid='.$_REQUEST['modid'].'&frmid='.$_REQUEST['frmid'].'');
 }

 if($_REQUEST['daction'])
{?>
<div class="success">Record <?php echo $_REQUEST['daction'] ?> Successfully </div><br>
<?php }?>



 <div align="center"> <a href="index.php?route=SalesManMaster&modid=<?php echo $_REQUEST['modid'];?>&frmid=<?php echo $_REQUEST['frmid'];?>&action=add">ADD NEW </a></div><br />
<?php 
  
   
   $cond="1=1";
   $GetRecord=$s->GetRecord("salesman_master",$cond);
   $result=DB_query($GetRecord,$db);
    
  ?>
 
 <table width="100%" border="0" cellspacing="2" cellpadding="2" >
  <tr>
    <th>SNo.</th>
	 <th>Type</th>
    <th>SaleExecutive Name</th>
    <th>Branch Master </th>
    <th>Email</th>
    <th>Edit</th><th>Delete</th>
  </tr>
  <?php $i=1;
 while( $row=DB_fetch_array($result))
 {
   ?>
  <tr bgcolor="#FFFFFF">
    <td><?php echo $i++;?></td>
	 <td><?php echo  $row['salesman_type']; ?></td>
    <td><?php echo  $row['sales_name']; ?></td>
	
    <td><?php
	 
 	$SQL_branch=DB_query("SELECT loccode,locationname FROM  locations Where loccode='".$row['branch_name']."'",$db);
    $row_branch=DB_fetch_array($SQL_branch);
	echo $row_branch['locationname'];
	  ?></td>
     <td><?php echo  $row['email'] ;?></td>
    <td><a href="index.php?route=SalesManMaster&modid=<?php echo $_REQUEST['modid'];?>&frmid=<?php echo $_REQUEST['frmid'];?>&action=edit&id=<?php echo $row['id']?>"><img src="images/icon-edit.png"  width="10" height="10"></a></td>
	<td><a href="index.php?route=View_SalesManMaster&modid=<?php echo $_REQUEST['modid'];?>&frmid=<?php echo $_REQUEST['frmid'];?>&action=delete&id=<?php echo $row['id']?>" onclick="return confirm('This Salesman will be deleted. Are you sure?')"><img src="images/Icon_Delete.png" width="10" height="10"></a></td>
  </tr>
 <?php } ?> 
</table>

<?php
include('includes/footer.inc');
?>
