<?php
include("include/data.php");
Init_boutique();
global $base, $MySQL_Host, $MySQL_User, $MySQL_Passw, $myart, $result, $NbLigne, $semaine, $limitesuivante, $limiteprecedente, $total, $page, 
$Ident_four, $Nom_Client, $observations, $Adresse_1, $Adresse_2, $Adresse_3, $Code_postal, $Ville, $Telephone, $Portable, $Email ;

// entete de la page

include 'menu/header.php';
$num_ordre=1;
$last_num_entre = 0 ;
$sql = 'SELECT max(Num_Client_Base) FROM clients_base';
$req = mysqli_query($link, $sql); 
$row = mysqli_fetch_row($req);
$last_num_entre = $row[0];
$last_num_entre = $last_num_entre + 1 ;

echo "<div class='titre-text'><center>Ajout Clients</div>" ;

echo "<center><HR size='1' width='500'>";
echo "<center>";
echo "<form name='FormClient' method='GET' action='traitement_ajout_clients_base.php'>";
echo "<input type='hidden' name='ordre' value='$num_ordre'/>";
echo "<table class='t-text' width='600' border='2' cellspacing='2' cellpadding='2'>";
echo "<tr>";
echo "<th width='120' align='center' valign='middle' scope='col'>Ident : </th>
      <th width='117' scope='col'>
	  <input name='let_client' type='text' id='let_client' accesskey='2' tabindex='2' value='$Ident_four' size='20' maxlength='10'></th>";
echo "<th width='120' align='center' valign='middle' scope='col'>Num base</th>
	  <th width='120' scope='col'>";
echo "$last_num_entre</th> ";
echo "</tr>";
echo "<tr>";
echo "<th align='center' valign='middle' scope='row'>Nom </th>
      <td colspan='0'>
      <input name='Nom_Client' type='text' id='Nom_Client' accesskey='3' tabindex='3' value='$Nom_Client' size='30' maxlength='30'>
	<td rowspan='4' colspan='3'>
	<center> Observations :
	<TEXTAREA name='observations' id='observations' accesskey='15' tabindex='15' value='$observations' rows=6 COLS=25>$observations</TEXTAREA></td>
        </center>
      </td>";
echo "</tr>";
echo "<tr>";
echo "<th align='center' valign='middle' scope='row'>Adresse </th>
      <td colspan='0'>
	  <input name='Adresse_1' type='text' id='Adresse_1' accesskey='4' tabindex='4' value='$Adresse_1' size='30' maxlength='30'></td>";
echo "</tr>";
echo "<tr>";
echo "<th align='center' valign='middle' scope='row'>Adresse</th>
      <td colspan='0'>
	  <input name='Adresse_2' type='text' id='Adresse_2' accesskey='5' tabindex='5' value='$Adresse_2'  size='30' maxlength='30'></td>";
echo "</tr>";
echo "<tr>";
echo "<th align='center' valign='middle' scope='row'>Adresse</th>
      <td colspan='0'>
	  <input name='Adresse_3' type='text' id='Adresse_3' accesskey='6' tabindex='6' value='$Adresse_3'  size='30' maxlength='30'></td>";
echo "</tr>";
echo "<tr>";
echo "<th align='center' valign='middle' scope='row'>Code Postal</th>
    <td Colspan='3'><input name='Code_postal' type='text' id='Code_postal' accesskey='7' tabindex='7' value='$Code_postal' size='5'>
	Ville <input type='text' name='Ville' id='Ville' accesskey='8' tabindex='8' value='$Ville' size='40'></td>";
echo "</tr>";
echo "<tr>";
echo "<th align='center' valign='middle' scope='row'>T&eacute;l&eacute;phone</th>
      <td><input name='Telephone' type='text' id='Telephone' accesskey='9' tabindex='9' value='$Telephone'></td>";
echo "<th align='center' valign='middle' >Portable</th>
      <td><input type='text' name='Portable' id='Portable' accesskey='10' tabindex='10' value='$Portable'></td>";
echo "</tr>";
echo "<th align='center' valign='middle' scope='row'>Email</th>
    <td><input name='Email' type='text' id='Email' accesskey='11' tabindex='11' value='$Email' size='30'>";
echo "</td>";
echo "<th align='center' valign='middle' scope='row'>Compte Cpta</th>
    	<td Colspan='2'><input name='Ccpta' type='text' id='Ccpta' accesskey='12' tabindex='12' value='$Ccpta'>";
echo "</td></tr>";
echo "<tr>";
echo "<th align='center' valign='middle' scope='row'>Code Transport</th>";
echo "<td><select style=' width: 200px;' name='CodeTrsp' id='CodeTrsp' accesskey='13' tabindex='13'>";
$sql = 'SELECT * FROM categorie_trsp';
$sql.=" WHERE `IdNumClient`='".$IdNumClient."'";  
$req = mysqli_query($link, $sql);
while ($row = mysqli_fetch_assoc($req)) {
  $num_li_trsp = $row["Num_Ligne_Cate_Trsp"];
  $Code_Trsp = $row["Code_Trsp"];
//  echo "$num_li_bl | $num_bl_base <br>" ;

  echo "<option value='$num_li_trsp'>$num_li_trsp | $Code_Trsp</option>";
}

echo "</select></td>";	

echo "<th align='center' valign='middle' >Code Paiement</th>";
echo "<td><select style=' width: 200px;' name='CodePaiement' id='CodePaiement' accesskey='14' tabindex='14'>";

$sql1 = 'SELECT * FROM categorie_paiement';
$sql1.=" WHERE `IdNumClient`='".$IdNumClient."'";  
$req1 = mysqli_query($link, $sql1);
while ($row = mysqli_fetch_assoc($req1)) {
  $num_li_paiement = $row["Num_Ligne_Cate_Paiement"];
  $Code_paiement = $row["Code_Paiement"];
//  echo "$num_li_bl | $num_bl_base <br>" ;

  echo "<option value='$num_li_paiement'>$num_li_paiement | $Code_paiement</option>";
}

echo "</select></td>";	
echo "</tr>";

echo "<tr>";
echo "<th align='center' valign='middle' scope='row'>Cat&eacute;gorie Client</th>";
echo "<td><select style=' width: 200px;' name='num_cate_clt' id='num_cate_clt' accesskey='15' tabindex='15'>";

$sql = 'SELECT * FROM categorie_Clients';
$sql.=" WHERE `IdNumClient`='".$IdNumClient."'";  
$req = mysqli_query($link, $sql);
while ($row = mysqli_fetch_assoc($req)) {
  $num_cate_clt = $row["num_cate_clt"];
  $cate_client = $row["categorie_clt"];
//  echo "$num_li_bl | $num_bl_base <br>" ;

  echo "<option value='$num_cate_clt'>$num_cate_clt | $cate_client</option>";
}

echo "</select></td>";	
echo "<th align='center' valign='middle' scope='row'>Code Tarifs</th>
    	<td Colspan='2'>";
//<input name='Tarifs' type='text' id='Tarifs' accesskey='12' tabindex='12' value='$Tarifs' size='10'>
echo "<select style=' width: 150px;' name='Tarifs' id='Tarifs' accesskey='16' tabindex='16'>";
$myart =new categorie_tarif;
$select = 'select * FROM categorie_tarif';
$result = mysqli_query($link, $select);
$myart->getnum($result);
while ($myart->z < $myart->num) {
  $myart->readrow($result);
  $num_cate_plu_intran=$myart->Num_Code_Tarif ;
  $categorie_plu_intran=$myart->Code_Tarif ;
  echo "<option value='$num_cate_plu_intran'>$num_cate_plu_intran | $categorie_plu_intran</option>";
}

echo "</select>";	
echo "</td></tr>";



echo "<tr>";
echo "<th colspan='2' align='center' valign='middle' scope='row'>
	  <input type='submit' name='ok' id='ok' value='Valider' accesskey='17' tabindex='17'></th>";
echo "<td colspan='2' align='center' valign='middle'>
	  <input name='an' type='button' id='an' accesskey='18' tabindex='18' value='Retour' onClick='history.back()'></td>";
echo " </tr></div>";
echo "</table>";
echo "</form>";


include 'menu/footer.php';
?>
