> >Sample No. 1 > >Select CVdtl >set order to CVnoacct >=Seek(lcDocNumb) >IF FOUND() > DO while CV_no=lcDocNumb .and. .not. EOF() > IIF .not. DELETED() > lnSLDBAmt = lnSLDBAmt + SLDebit > lnSLCRAmt = lnSLCRAmt + SLCredit > lnGLDBAmt = lnGLDBAmt + GLDebit > lnGLCRAmt = lnGLCRAmt + GLCredit > Endif > skip > enddo >ENDIF > > >Sample No. 2 > >SELECT SUM(A.SLDebit) as lnSLDBAmt, SUM(SLCredit) as lnSLCRAmt, SUM(GLCredit) as lnGLCRAmt, SUM(GLDebit) as lnGLDBAmt; >FROM CVdtl A WHERE A.CV_no=lcDocNumb .and. .not. DELETED() INTO CURSOR Temp1 GROUP BY A.CV_no > > >Sample No. 3 > >Select CVdtl >set order to CVnoacct >SCAN FOR CV_no=lcDocNumb > IF .not. DELETED() > lnSLDBAmt = lnSLDBAmt + SLDebit > lnSLCRAmt = lnSLCRAmt + SLCredit > lnGLDBAmt = lnGLDBAmt + GLDebit > lnGLCRAmt = lnGLCRAmt + GLCredit > Endif >ENDSCAN > >>
SET DELETED ON ** 1.: Select CVdtl set order to CVnoacct SEEK m.lcDocNumb SCAN WHILE CV_no = m.lcDocNumb lnSLDBAmt = lnSLDBAmt + SLDebit lnSLCRAmt = lnSLCRAmt + SLCredit lnGLDBAmt = lnGLDBAmt + GLDebit lnGLCRAmt = lnGLCRAmt + GLCredit ENDSCAN *** 2. SYS(3054,12,[testSQL]) SELECT SUM(A.SLDebit) as lnSLDBAmt,; SUM(SLCredit) as lnSLCRAmt,; SUM(GLCredit) as lnGLCRAmt,; SUM(GLDebit) as lnGLDBAmt; FROM CVdtl A; WHERE A.CV_no=lcDocNumb ; INTO CURSOR Temp1; GROUP BY A.CV_no SYS(3054,0) MessageBox(TestSQL)