<?php

$PageSecurity = 15;

$title = _('Dealer Store Types');

 $modid=$_REQUEST['modid'];

$frmid=$_REQUEST['frmid'];

$table='dealer_store';

$url="&modid=".$modid."&frmid=".$frmid;

$targetpage="index.php?route=DealerDistrbutions/Setup/dealer_store_type_index".$url;

if(isset($_POST['submit']) && $_REQUEST['action']=='Addnew')

{

$data['company']=$_REQUEST['company'];

$data['store_type_name']=$_REQUEST['storetype_name'];

$data['store_type_code']=$_REQUEST['store_type_code'];

$data['created_date']=date('y-m-d');

$row= $s->RecordInsert(dbl_dealer_store_type, $data);

$s->pageLocation($targetpage.$url);



}

	

if($_REQUEST['action']=='Edit' && !isset($_POST['submit']))

{

$sql=DB_query("select * from dbl_dealer_store_type where id='".$_REQUEST['id']."'",$db);

$row1=DB_fetch_array($sql);

extract($row1);







}

if(isset($_POST['Cancel']))

{

$s->pageLocation($targetpage.$url);



}



if(isset($_POST['submit']) && $_REQUEST['action']=='Edit')

{

$data['company']=$_REQUEST['company'];

$data['store_type_name']=$_REQUEST['storetype_name'];

$data['store_type_code']=$_REQUEST['store_type_code'];

$cond="id='".$_REQUEST['id']."'";

$update= $s->RecordEdit(dbl_dealer_store_type, $data, $cond);

$s->pageLocation($targetpage.$url);



}

?>

<link rel="stylesheet" href="css/new_mxerp.css">

<div class="body_contain">

<div class="tab_div">

<h1>Associate Store Type </h1>

<p align="right"><a href="<?php echo $targetpage; ?>"><input type="button" name="Go" value="Go Back" class="search"></a></p>

<form method="post" action="">



	

	<table border="0" cellpadding="2" cellspacing="2" width="100%">

	<tr class="row1">

	<td  class="tabledata1">&nbsp;</td>

    <td colspan="2"  class="tabledata1"><table width="62%" align="center" height="24" border="0" cellpadding="0" cellspacing="0">

      <tr>

        <td width="42%"><strong>Company<font color="#FF0000"><strong>*</strong></font></strong></td>

        <td width="58%"><?php $sql='SELECT * FROM `companies`';

		$resultStkLocs = DB_query($sql,$db); ?>

        <select name="company" id="company" style="width:150px;" >

            <option value="0">Select</option>

            <?php

while ($myrow=DB_fetch_array($resultStkLocs))

{?>

            <option value="<?php echo $myrow['CompanyId'];?>"<?php echo ($company==$myrow['CompanyId']?'selected':'')?>><?php echo $myrow['CompanyName'];?></option>

            <?php } ?>

                </select></td>

      </tr>

    </table></td>

    <td  class="tabledata1">&nbsp;</td>

	</tr>

	<?php if($_REQUEST['action']=='Edit'){ 

	$s1='';

	} else { $s1="onkeyup=ShowDiv(this.value,'storetype1','storecodedata.php')"; } ?>

<tr class="row1">

	<td width="23%" align="center"  class="tabledata1"><strong>Store Type Name <font color="#FF0000"><strong>*</strong></font></strong></td>

    <td width="26%"><input type="text" name="storetype_name" id="storetype_name" style="width:150px;"  <?php echo $s1; ?> value="<?php echo $store_type_name; ?>"/></td>

	<td width="24%" align="center" class="tabledata1"><strong>Store Type Code <font color="#FF0000"><strong>*</strong></font></strong></td>

	<td width="27%"><div id="storetype1"><input type="Text" size="20"  name="store_type_code" id="store_type_code" style="width:150px;" value="<?php echo $store_type_code; ?>" /></div></td>

</tr>

<tr class="row1">

<td colspan="4" align="center" ><div class="centre"><input type="submit" name="submit" VALUE="Save" onclick="return validate();" class="search">

<input type="submit" name="Cancel" VALUE="Cancel" class="search"></div></td>

</tr>

</table>







</form>

</div></div>