mesela comboxta seçili ögem 0 ise firmaya göre arama işlemi yaptırıyorum ve ben bunu
Kod: Tümünü seç
if cb_kriter.ItemIndex=0 then sql.Add('WHERE UPPER(FIRMA.KODU) LIKE UPPER('+quotedstr('%'+ed_ara.Text+'%')+')')
Kod: Tümünü seç
with QrKargoListe do
begin
if active then
begin
sql.Clear;
sql.Add('SELECT FIRMA.KODU,FIRMA.UNVAN,KARGO.TANIM,KARGO.TUR,KARGO.GOND_TAR,KARGO.GOND_ID,');
sql.Add('KULLANICI.AD_SOYAD,KARGO.KAR_FIR_ID,KARGO.TEYIT_TAR,KARGO.TEYIT_ID,');
sql.Add('KISI.AD_SOYAD,ADRES.TANIM FROM KARGO');
sql.add('LEFT OUTER JOIN FIRMA ON KARGO.FIRMA_ID=FIRMA.FIRMA_ID');
sql.add('LEFT OUTER JOIN KULLANICI ON KARGO.GOND_ID=KULLANICI.ID');
sql.add('LEFT OUTER JOIN KISI ON KARGO.TEYIT_KISI_ID=KISI.KISI_ID');
sql.add('LEFT OUTER JOIN ADRES ON KARGO.ADRES_ID=ADRES.ADRES_ID');
if cb_kriter.ItemIndex=0 then sql.Add('WHERE UPPER(FIRMA.KODU) LIKE UPPER('+quotedstr('%'+ed_ara.Text+'%')+')')
else if cb_kriter.ItemIndex=1 then sql.Add('WHERE UPPER(FIRMA.UNVAN) LIKE UPPER('+quotedstr('%'+ed_ara.Text+'%')+')')
else if cb_kriter.ItemIndex=2 then sql.Add('WHERE UPPER(KARGO.TANIM) LIKE UPPER('+quotedstr('%'+ed_ara.Text+'%')+')')
else if cb_kriter.ItemIndex=3 then sql.Add('WHERE KARGO.TUR='+inttostr(RdTur.ItemIndex))
else if cb_kriter.ItemIndex=4 then sql.Add('WHERE KARGO.GOND_TAR BETWEEN '+quotedstr(datetostr(DtTar1.Date))+' AND '+quotedstr(datetostr(DtTar2.Date)))
else if (cb_kriter.ItemIndex=5)and(CbPersonel.Text<>'') then sql.Add('WHERE KARGO.GOND_ID='+inttostr(CbPersonel.EditValue))
else if (cb_kriter.ItemIndex=6)and(CbKargo.Text<>'') then sql.Add('WHERE KARGO.KAR_FIR_ID='+inttostr(CbKargo.EditValue))
else if cb_kriter.ItemIndex=7 then sql.Add('WHERE KARGO.TEYIT_TAR BETWEEN '+quotedstr(datetostr(DtTar1.Date))+' AND '+quotedstr(datetostr(DtTar2.Date)))
else if (cb_kriter.ItemIndex=8)and(CbPersonel.Text<>'') then sql.Add('WHERE KARGO.TEYIT_ID='+inttostr(CbPersonel.EditValue));
open;
end;
end;