Function ReadSQL(W: String): String;
Begin
  Result:= 'Select TARIH, K.KASAADI, I.ISLEMADI, H.ACIKLAMA, TUTAR From TBLKASAHAREKET H ' +
     ' LEFT OUTER JOIN TBLKASALAR K ON K.ID = H.KASA ' + 
	 ' LEFT OUTER JOIN TBLKASAISLEMLER I ON H.ISLEM = I.ID ';
	 
  if W <> '' Then
    Result:= Result + ' WHERE I.ID IN(' + W + ')';
End;

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

Function RaporFileName: String;
Begin
  Result:= ParsDir + 'Kasa Raporları\Kasa Harcama.fr3';
End;

procedure RaporLoad;
Begin
  SetViewCaption('BASLIK', 'PARADOX KASA HARCAMA RAPORU');
  if FFilter <> '' Then
    AddQueryToSQL('KullaniciQ', ' WHERE I.ID IN(' + FFilter + ')');
  AddQueryToSQL('KullaniciQ', 'ORDER BY TARIH');  
End;

procedure Start;
Begin
End;

Procedure Finish;
Begin
End;

Function ReadFilter(Var F: String): Boolean;
Begin
  F:= SelectRecord('Select ID, ISLEMADI From TBLKASAISLEMLER WHERE DELETED = 0', 
     'ISLEMADI', 
	 'İşlem', 
	 'ID', 
	 'İşlem', 
	 'ISLEMADI', 
	 True);
  Result:= F <> '';
End;

procedure Execute;
Var
  IDS: String;
Begin
  if ReadFilter(IDS) Then
  Begin
    CreateReport(IDS, ReadSQL(IDS), 
     'TARIH;KASAADI;ISLEMADI;ACIKLAMA;TUTAR', 
	 'Tarih;Kasa;İşlem;Açıklama;Tutar', 
	  0);
  End;
End;

Begin
End.