<?php
$PageSecurity = 15;
$title = _('Store Types');


	

	
?>
	<form method="post" action="">
    <center>
	<table border="0" cellpadding="2" cellspacing="2">	
	<tr>
	<td><strong>Dealer Store code </strong></td>
	<td><input type="Text" size="20"  name="TypeAbbrev"></td>
	</tr>
<tr>
<td><strong>Dealer Store Name </strong></td>
<td><input type="Text" name="Sales_Type" value="<?php echo $_POST['Sales_Type'];?>"></td>
</tr>
<tr>
<td><strong>Dealer </strong></td>
<td><?php   $sql = 'SELECT loccode, locationname FROM locations';
		$resultStkLocs = DB_query($sql,$db);
?>		
<select name="store_site" id="store_site"><?php
while ($myrow=DB_fetch_array($resultStkLocs))
{?>
<option Value="<?php echo $myrow['loccode'];?>"<?php echo ($_POST['store_site']==$myrow['loccode']?'selected':'')?>><?php echo $myrow['locationname'];?></option>
<?php } ?>
</select></td></tr>
</table>
<br />
<div class="centre"><input type="submit" name="submit" VALUE="Save">
<input type="submit" name="Cancel" VALUE="Cancel"></div>
</center>
</form>
<?php } 
if (!isset($SelectedType))
{
   	$sql = "SELECT * FROM storetype where CompanyId='".$_SESSION['ACGCompanyId']."'";
	$result = DB_query($sql,$db);
?>
	<table border="0" cellpadding="2" cellspacing="2" class="inborder" style="background:#dce6f2; margin-top:20px;">
	<tr>
		<th><strong>Store Code </strong></th>
		<th><strong>Store Name </strong></th>
		<th><strong>Unit </strong></th>
		<th><strong>Edit</strong></th>
		<th><strong>Delete</strong></th>
	</tr><?php
	$k=0; //row colour counter
while ($myrow = DB_fetch_row($result))
 {?>
	<tr bgcolor="#FFFFFF">
	<td><?php echo $myrow[1];?></td>
		<td><?php echo $myrow[2];?></td>
		<td><?php echo $myrow[3];?></td>
		<td><a href="index.php?route=Storetype&modid=<?php echo $_REQUEST['modid'];?>&frmid=<?php echo $_REQUEST['frmid'];?>&SelectedType=<?php echo $myrow[0];?>">Edit</a></td>
		<td><a href='index.php?route=Storetype&modid=<?php echo $_REQUEST['modid'];?>&frmid=<?php echo $_REQUEST['frmid'];?>&SelectedType=<?php echo $myrow[0];?>&delete=yes' onclick="return confirm('This store will be deleted. Are you sure?')">Delete</a></td>
	  </tr><?php
	}?>
</table>
	<?php }
include('includes/footer.inc');
?>