e.g. select 22 && wrong use MyTable Use MyTable in 0 && right2) After a Set Filter, you must move the file pointer, e.g. Go Top, before the filter takes effect. I see you set filter then do a COUNT, which will give you a pre-filter result.
SCAN If MyCondition Code Code If condition2 Do while x = y Enddo Endif Endif EndSCAN5) You do things like :
>close all >set talk off >set echo off >set safety off > > select 22 > use newtax excl > zap > > select 4 > use tax1 > index on no to kkk > > m.no=no > m.nettot=nettot > m.nam=nam > m.nam2=nam2 > m.nam3=nam3 > m.nam4=nam4 > m.month1=monthnam > > select 4 > do while .t. > > scatter memvar > m.aa=nettot > select 5 > use tax2 > append blank > gather memvar > >select 1 >use mstr >locate for no=m.no >m.dat=dat >M.NATI=NATI >M.CHILD=CHILD >M.STAT1=STAT1 >M.RNTPLAC=RNTPLAC >M.AS1=0 >M.UNV=UNV >M.UNV1=UNV1 >M.UNV2=UNV2 >M.UNV3=UNV3 >M.UNV4=UNV4 > > > IF M.UNV<>SPACE(10) > M.AS1=M.AS1+1 > ENDIF > > IF M.UNV1<>SPACE(10) > M.AS1=M.AS1+1 > ENDIF > > > IF M.UNV2<>SPACE(10) > M.AS1=M.AS1+1 > ENDIF > > IF M.UNV3<>SPACE(10) > M.AS1=M.AS1+1 > ENDIF > > IF M.UNV4<>SPACE(10) > M.AS1=M.AS1+1 > ENDIF > > replace dat with m.dat > replace NATI with m.NATI > replace CHILD with m.CHILD > REPLACE RNTPLAC WITH M.RNTPLAC > > IF M.STAT1="متزوج " > REPLACE STAT1 WITH "متزوج " > ELSE > REPLACE STAT1 WITH "اعزب" > ENDIF > > > >select 4 >skip >if m.no<>no > select 5 > use tax2 excl > index on no to kk > go top > set filter to no=m.no > count to df > sum nettot to kk for m.no=no > sum totcut to ll for m.no=no > sum cut5 to ee for m.no=no > sum cut4 to tt for m.no=no > sum MSAL to ff for m.no=no > sum cut1 to cx for m.no=no > sum cut2 to ew for m.no=no > sum cut3 to ty for m.no=no > sum allad to qty for m.no=no > sum vdisc to tareq for m.no=no > SUM TOTALADD TO ERT for m.no=no > M.ERT1=ERT-tareq > > select 22 > use newtax > append blank > gather memvar > replace no with m.no > replace totalsal with kk > replace totcut with ll > replace cut5 with ee > replace cut4 with tt > replace MSAL with ff > replace cut1 with cx > replace cut2 with ew > replace cut3 with ty > replace allad with qty > replace countt with df > replace total with (kk+ll)-(cx+ew+ty) > replace AS1 with m.AS1 > replace vdisc with tareq > replace TOTALADD with M.ERT1 > > select 5 > use tax2 excl > index on no to kk > report form COPtax1 > zap >endif > > select 4 > m.no=no > m.nam=nam > m.nam2=nam2 > m.nam3=nam3 > m.nam4=nam4 > m.month1=monthnam > if eof() > exit > else > endif > >enddo > >>