<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Liste des CAs par Fournisseurs </title>
<CENTER><img src="imag/haut.jpeg" width="995" height="67"></CENTER><BR>
<!--#include file="base.inc"-->
</head>
<HR>
<center>
<strong>
<form method="post" action="tri.asp" name="stand">
<% response.write("Veuillez entrer une date de début (JJ-MM-AAAA) :") %> <input type="text" name="dateDeb" value="<% IF (trim(session("d1")) <> "") THEN response.Write(session("d1")) END IF %>" > <br>
<% response.write("Veuillez entrer une date de fin (JJ-MM-AAAA)      :") %> <input type="text" name="dateFin" value="<% IF (trim(session("d2")) <> "") THEN response.Write(session("d2")) END IF %>" > <br><br>
<input type="submit" value="VALIDER">
</FORM>
</strong>
</center>
<HR><BR>
<script language="javascript">
function Tri1()
{
document.forms.stand.submit();
}
function Tri2()
{
document.forms.FormTriCA.submit();
}
</script>
<%
DIM Tab(500, 3)
IF (trim(session("d1")) <> "") AND (trim(session("d2")) <> "") THEN
d1=datevalue(session("d1"))
d2=datevalue(session("d2"))
ELSE
d1=datevalue("10-10-1990")
d2=datevalue("10-10-2100")
END IF
%>
<body>
<TABLE border="2" align="center">
<TR bgcolor="#DDDDEE" style="cursor:pointer">
<TD onclick="Tri1()"><strong><center> CODE FOURNISSEUR </center></strong></TD>
<TD onclick="Tri1()"><strong><center> NOM FOURNISSEUR </center></strong></TD>
<TD onclick="Tri2()"><strong><center> CA </center></strong></TD>
</TR>
<%
IF session("TriCA")=0 THEN
SET rsFour = Server.CreateObject("ADODB.Recordset")
rsFour.open"SELECT Code_Fou, Nom FROM Fournisseurs ORDER BY Code_fou", conn
indFour=0
DO WHILE NOT rsFour.eof
CodeFour=trim(rsFour("Code_fou"))
NomFour=trim(rsFour("Nom"))
SET rsFourSelect = Server.CreateObject("ADODB.Recordset")
rsFourSelect.open"SELECT Num_cde FROM EnteteCdeAchat WHERE Code_Fou = '"& CodeFour &"' ", conn
total=0
DO WHILE NOT rsFourSelect.eof
refCde = trim(rsFourSelect("Num_cde"))
SET rsCA = Server.CreateObject("ADODB.Recordset")
SET rsDate = Server.CreateObject("ADODB.Recordset")
rsDate.open"SELECT Date_mvt FROM Mouvements WHERE Origine = '"& refCde &"' GROUP BY Origine, Date_mvt", conn
IF NOT rsDate.eof THEN
IF ( DATEVALUE(rsDate("Date_mvt")) >= d1 ) AND ( DATEVALUE(rsDate("Date_mvt")) <= d2 ) THEN
rsCA.open"SELECT Prix_Unit, Quantite FROM LigneCdeFou WHERE Num_cde = '"& refCde &"'", conn
IF NOT rsCa.eof THEN
DO WHILE NOT rsCA.eof
total = total + ( rsCA("Prix_unit") * rsCA ("Quantite") )
rsCA.movenext
LOOP
END IF
END IF
END IF
rsFourSelect.movenext
LOOP
IF total > 0 THEN
Tab(indFour, 0)=CodeFour
Tab(indFour, 1)=NomFour
Tab(indFour, 2)=total
indFour=(indFour+1)
END IF
rsFour.movenext
LOOP
FOR i=0 to (indFour-1)
%>
<TR>
<TD><center> <% =Tab(i,0) %> </center></TD>
<TD><center> <% =Tab(i,1) %> </center></TD>
<TD><center> <% =Tab(i,2) %> </center></TD>
</TR>
<%
NEXT
session("TabCA1")=Tab
session("Ind")=(indFour-1)
ELSE
Dim S(500,3)
S=session("TabCA2")
FOR i=0 to (session("Ind"))
%>
<TR>
<TD><center> <% =S(i,0) %> </center></TD>
<TD><center> <% =S(i,1) %> </center></TD>
<TD><center> <% =S(i,2) %> </center></TD>
</TR>
<%
NEXT
END IF
session("TriCa")=0
%>
</TABLE>
<br>
<form method="post" action="menuachat.asp">
<center><input type="submit" value="Retour Menu Achat" style="width:15%"></center>
</form>
<form method="post" action="Tri_ca.asp" name="FormTriCA"></form>
</body>
</html>
Partager