<?php
  switch($Etape)
  {
    case 0:
	  echo "<script language=\"javascript\">\n";
	  echo "jQuery(document).ready(function($) {\n"; 
	  echo "  jQuery('.wbdatepicker').datepicker($.datepicker.regional[ \"fr-CH\" ]);\n";
	  echo "  jQuery('input').blur();\n";
	  echo "});\n";
	  echo "</script>\n";

      echo "<form name='info'>";
      echo "<TABLE border=1><TR><TH>Date</TH><TD>";
	  //.Cree_Entree_Type("intervalle",2,0,"",RECHERCHE).
      echo "<input type='text' class='wbdatepicker' name='DateDebut' size='10'> au <input type='text' class='wbdatepicker' name='DateFin' size='10'>";
	  echo "</TD></TR></TABLE>";
      echo "<input type='hidden' name='Type' value=$Type>";
      echo "<input type='hidden' name='Sous_Type' value=$Sous_Type>";
      echo "<input type='hidden' name='Etape' value='1'>";
      echo "<script language=JavaScript>\n";
      echo "force_submit=true;\n";
      echo "this.document.forms['info'].elements[0].focus();\n";
      echo "</script>\n";
      echo "<button type='button' onClick='submit_ok(this.form);'>Rechercher</button>";
      echo "</form>";
    break;
    case 1:
      $start = substr($DateDebut,6,4)."-".substr($DateDebut,3,2)."-".substr($DateDebut,0,2)." 00:00:00";
      $end = substr($DateFin,6,4)."-".substr($DateFin,3,2)."-".substr($DateFin,0,2)." 23:59:59";
      $resultat = LogMVTPieces::getByLesserMontantAndPeriod(0, $start, $end);
      echo "<TABLE border=\"1\"><TR><TH>No commmande</TH><TH>No article</TH><TH>Quantité</TH><TH>Montant</TH><TH>Date</TH><TH>Personne</TH></TR>";
      foreach ($resultat as $ligne)
      {
		echo "<TR><TD><a href=\"default.php?Type=$Type&Sous_Type=$Sous_Type&Etape=2&NoCommande=".$ligne["NoCommande"]."\">".$ligne["NoCommande"]."</a></TD><TD>".$ligne["NoArticle"]."</TD><TD>".$ligne["Nb"]."</TD><TD>".$ligne["Montant"]."</TD><TD>".$ligne["Date"]."</TD><TD>".$ligne["Personne"]."</TD></TR>";
	  }
	  echo "</TABLE>";
	break;
    case 2:
      $resultat = LogMVTPieces::getByNoCommande($NoCommande);
      echo "<TABLE border=\"1\"><TR><TH>No commmande</TH><TH>No article</TH><TH>Quantité</TH><TH>Montant</TH><TH>Date</TH><TH>Personne</TH></TR>";
      foreach ($resultat as $ligne)
      {
		echo "<TR><TD>".$ligne["NoCommande"]."</TD><TD>".$ligne["NoArticle"]."</TD><TD>".$ligne["Nb"]."</TD><TD>".$ligne["Montant"]."</TD><TD>".$ligne["Date"]."</TD><TD>".$ligne["Personne"]."</TD></TR>";
	  }
	  echo "</TABLE>";
	break;
  }
?>
