<?php
include "../include/configsession.php";
include "../include/validsession.inc";
include "../include/top.inc";
include "../include/fonction.inc";
include "../include/opendb.inc";
?>

<?php
$code = $_REQUEST["code"];
$exist = $_REQUEST["exist"];

if ( isset($code) && !empty($code) ) {
$strSqlM = "SELECT * from rabais where CodeR = ". $code ."";
$rsQueryM = mysql_query($strSqlM);
mysql_error();
if ($row = mysql_fetch_assoc($rsQueryM)) {
$Nom = $row["Nom"]; 
$Description = $row["Description"]; 
$Statut = $row["Statut"]; 
$Valeur  = $row["Valeur"]; 
}
}
?>

<SCRIPT Language="JAVASCRIPT">

function nextStep()
{
	if (validate() == true)
	{
		document.Rabais.action="xtRabais.php";
		document.Rabais.method = "Post"
		document.Rabais.submit();
	}
}

function validate()
{
	if (document.Rabais.Nom.value == "")
	{
		alert("SVP le Nom est obligatoir");
		document.Rabais.Nom.focus();
		return false
	}
		   
return true
}
</Script>



<table>
        <tr> 
          <td width="5">&nbsp;</td>
          <td valign="top" width="738"><table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr> 
          <td width="23" rowspan="2"><img src="<?php echo $path; ?>/images/innertopleft.gif" width="23" height="23"></td>
          <td bgcolor="#000066" width="1"><img src="<?php echo $path; ?>/images/clearpix.gif" width="1" height="1"></td>
          <td width="23" rowspan="2"><img src="<?php echo $path; ?>/images/innertopright.gif" width="23" height="23"></td>
        </tr>
        <tr>
          <td width="100%"><img src="<?php echo $path; ?>/images/a.gif" width="1" height="22"></td>
        </tr>
        <tr>
          <td background="<?php echo $path; ?>/images/leftbg.gif"><img src="<?php echo $path; ?>/images/clearpix.gif" width="23" height="1"></td>
          <td width="100%" valign="top" class="formtitre">
          <img border='0' src='<?php echo $path; ?>/images/bartxt1.gif' width="54" height="11"><b>Rabais</b><br>
          &nbsp;
            <table width="680" BORDER="0" CELLPADDING="0" CELLSPACING="0">
			
              <tr>
                <td align="left" width="394">
                 <FORM Action="xtRabais.php" Method=Post Name="Rabais">
                    <table width="683" BORDER="0" CELLPADDING="0" CELLSPACING="1">
                      <tr>
                        <td width="129" valign="top">&nbsp;</td>
                        <td width="158" valign="top"></td>
                        <td width="102" valign="top"></td>
                        <td width="121" valign="top"></td>
                        <td valign="top" width="143" colspan="2"></td>
                      </tr>
                      <tr>
                        <td width="129" valign="top"></td>
                        <td width="381" valign="top" colspan="3"><font class="formtxt"><?php if ($exist == 1) { echo ("le nom choisi existe déjà"); } ?></font></td>
                        <td valign="top" width="143" colspan="2"></td>
                      </tr>
                      <tr>
                        <td width="129" valign="top"><img src="<?php echo $path; ?>/images/p.gif" border="0" width="6" height="6">
						<font class="formtxt">Nom :</font></td>
                        <td width="381" valign="top" colspan="3"><input type="text" NAME="Nom" value = "<?php echo $Nom ;?>" size="10" class="input" style="width: 384; height: 16" tabindex="6"></td>
                        <input type="hidden" NAME="code" value = "<?php echo $code; ?>" size="10" class="input" style="width: 384; height: 16" tabindex="6">
                        
                        
                        <td valign="top" width="72"></td>
                        <td valign="top" width="71"></td>
                      </tr>
                      <tr>
                        <td width="129" valign="top">
                            <img src="<?php echo $path; ?>/images/pb.gif" border="0" width="6" height="6"><font class="formtxt">Description</font><font class="formtxt">
                          :</font>
                        </td>
                        <td width="381" valign="top" colspan="3"><textarea rows="2" name="Description" cols="50" class="input1" tabindex="8"><?php echo $Description; ?></textarea></td>
                        <td valign="top" width="72"></td>
                        <td valign="top" width="71"></td>
                      </tr>
                      <tr>
                        <td width="129" valign="top"><img src="<?php echo $path; ?>/images/p.gif" border="0" width="6" height="6"><font class="formtxt">Statut
                          :</font></td>
                        <td width="158" valign="top"><select name="Statut" class="select" size="1" tabindex="7">
							<option value="0" <?php if ($Statut == 0){ echo "selected"; }  ?>>Inactif</option>
                            <option value="1" <?php if ($Statut == 1){ echo "selected"; }  ?>>Actif</option>
                            
                          </select></td>
                        <td width="102" valign="top" class="formtxt"><img src="<?php echo $path; ?>/images/pb.gif" border="0" width="6" height="6">Valeur :</td>
                        <td width="121" valign="top"><input type="text" NAME="Valeur" value = "<?php echo $Valeur; ?>" size="10" class="input" style="width: 91; height: 16" tabindex="6"></td>
                        <td valign="top" width="143" colspan="2"></td>
                      </tr>
					  
                    </table>
                  
                    <table width="683" BORDER="0" CELLPADDING="0" CELLSPACING="1">
                      <tr>
                        <td width="648" valign="top">&nbsp;
                          </td>
                      </tr>
                      <tr>
                        <td width="648" valign="top">
                          <p align="center"><input type="button" value=" :: Suivant :: " onclick="javascript:nextStep();" class=btnfrm id=button1 name=button1></td>
                      </tr>
                      <tr>
                        <td width="648" valign="top">
                          <p align="center"><br>
                      <input type="button" value=" :: Retour :: "onclick="javascript:history.back();" class=btnfrm id=button1 name=button1>
                          
</td>
                      </tr>
                    </table>
                  </td>
                </tr>
              </table>
            </td>
            <td width"23" background="<?php echo $path; ?>/images/rightbg1.gif"><img src="<?php echo $path; ?>/images/clearpix.gif" width="23" height="1"></td>
          </tr>
          <tr>
            <td width="23" rowspan="2"><img src="<?php echo $path; ?>/images/innerbottomleft.gif" width="23" height="23"></td>
            <td width="100%">
              <p align="center"><img src="<?php echo $path; ?>/images/a.gif" width="1" height="22"></td>
            <td width="23" rowspan="2"><img src="<?php echo $path; ?>/images/innerbottomright.gif" width="23" height="23"></td>
          </tr>
          <tr>
            <td width="1" bgcolor="#000066" height="1"><img src="<?php echo $path; ?>/images/clearpix.gif" width="1" height="1"></td>
          </tr>
        </table>
        <font color="#0000FF"><img src="<?php echo $path; ?>/images/clearpix.gif" width="1" height="22"></font>

  
<?php
  include "../include/footer.inc";
?>