Create cursor stockidtypes (nType i) for ix=1 to 5 with eval('thisform.chkStockIdType'+trans(ix)) if .Value insert into stockidtypes values (ix) endif endwith endfor SELECT ... ; Crsvdplan cp ; inner join stockidtypes si on cp.StockTypeID = si.nType ; where &lcWhere ...Cetin
>WITH thisform >lcWhere1 = 'between (crsvdplan.dosyano,thisform.txtdosyano.Value,thisform.txtdosyano1.Value)' >lcWhere2 = 'between (crsvdplan.orderterminhf,thisform.txthafta1.Value,thisform.txthafta2.Value)' >lcWhere3 = 'between (crsvdplan.sipterminhf,thisform.txthafta3.Value,thisform.txthafta4.Value)' >lcWhere4 = 'between (crsvdplan.fissevktar,thisform.txttertar1.Value,thisform.txttertar2.Value)' >lcWhere5 = IIF(EMPTY(.txttip.Value), '.t.', 'crsvdplan.mkod=thisform.txttip.Value') >lcWhere6= IIF(EMPTY(.txtfirma.value), '.t.', 'crsvdplan.ckod=thisform.txtfirma.Value') >lcWhere7 = 'between (crsvdplan.fistipi,thisform.txtnitelik.Value,thisform.txtnitelik2.Value)' >lcWhere8 = 'between (crsvdplan.termin,thisform.txtplter1.Value,thisform.txtplter2.Value)' >lcWhere9 = 'between (crsvdplan.tarih,thisform.txtgeltar1.Value,thisform.txtgeltar2.Value)' >lcWhere10 = 'between (crsvdplan.gecikme,thisform.txtgecikme1.Value,thisform.txtgecikme2.Value)' >lcWhere11 = IIF(EMPTY(.txtpartino.Value), '.t.', 'crsvdplan.partino=thisform.txtpartino.Value') >lcWhere12 = IIF(EMPTY(.txtrenkno.Value), '.t.', 'crsvdplan.labno=thisform.txtrenkno.Value') >lcWhere13 = IIF(EMPTY(.txtfinansdurumu.Value), '.t.', 'crsvdplan.idealyorum=thisform.txtfinansdurumu.Value') > >ENDWITH > >lcWhere = lcWhere1 + ' and ' + ; >lcwhere13 + ' and ' + ; >lcwhere2 + ' and ' + ; >lcwhere3 + ' and ' + ; >lcwhere5 + ' and ' + ; >lcwhere6 + ' and ' + ; >lcwhere8 + ' and ' + ; >lcwhere9 + ' and ' + ; >lcwhere10 + ' and ' + ; >lcwhere11 + ' and ' + ; >lcwhere12 + ' and ' + ; >lcwhere4 + 'and' + lcwhere7 > > SELECT dosyano,fistipi,fisno,ckod,cadi,mkod,madi,renkadi,labno,partino,gereken,; > sum(sipmiktari)as toplamsiparis,sum(netmiktar) as toplam_net_gelen,; > sum(brutmiktar) as toplam_brut_gelen,sum(brutmiktar)- sum(netmiktar) as brut_net_farki,; > VAL(gereken)-sum(sipmiktari) as verileceksiparis,VAL(gereken)-sum(netmiktar) as kalansiparis from; > Crsvdplan where &lcWhere; > into curs crsresult nofilter > >DO FORM forms\sorgufrm >