procedure Start;
Begin
End;

Procedure Finish;
Begin
End;

Function ReadFilter(Var F: String): Boolean;
Begin
  F:= '';
  Result:= True;
End;

Function ReadSQL(W: String): String;
Begin
  Result:= 'Select '#13 +
		   '   C.FIRMAADI, STOKKODU, CINSI, S.KOD1 AS MARKA, RN.KOD AS RENK, D.KOD AS DESEN,  SUM(R.MIKTAR) AS MIKTAR '#13 +
		   ' from TBLRESERVE R '#13 +
		   ' LEFT OUTER JOIN TBLCARI C ON C.KARTNO = R.CARIID '#13 +
		   ' LEFT OUTER JOIN TBLBIRIMLEREX B ON B.KARTNO = R.BIRIMID '#13 +
		   ' LEFT OUTER JOIN TBLSTOKLAR S ON S.KARTNO = B.STOKID '#13 +
		   ' LEFT OUTER JOIN TBLRENKLER RN ON RN.ID = R.RENKID '#13 +
		   ' LEFT OUTER JOIN TBLHALIDESENLER D ON D.ID = R.DESENID  '#13 +
		   ' GROUP BY FIRMAADI, STOKKODU, CINSI, S.KOD1, RN.KOD, D.KOD';
End;

Function RaporDefaultSQL: String;
Begin
  Result:= ReadSQL('');
End;

Function RaporFileName: String;
Begin
  Result:= '';
End;

procedure Execute;
Var
  IDS: String;
Begin
  if ReadFilter(IDS) Then
  Begin    
    CreateReport(IDS, ReadSQL(IDS), 
     'FIRMAADI;STOKKODU;CINSI;MARKA;RENK;DESEN;MIKTAR', 
	 'Firma;Stok Kodu;Cinsi;Marka;Renk;Desen;Miktar', 
	  0);
    CreateSummary('STOKKODU', skCount);
	CreateSummary('MIKTAR', skSum);
  End;
End;

Begin
End.
