<% thepage =upper(orequest.form('newpage')) set date ymd set cent on datefrom =orequest.form("datefrom") dateto =orequest.form("dateto") pdate1=ctod(datefrom) pdate2=ctod(dateto) DBO="DEBIT AMT" CBO="CREDT AMT" LBO="BALANCE" MDB=0 MCR=0 TSTR=[] thestr=[] strhead=[] openingbalances=0 strend=[] set date british PACCOUNTID=nvl(orequest.form('accountcode'),'') tsql=[select * from (']+dbclocation+[accounts') where accountid=']+paccountid+[' into cursor theperson] &tsql if not empty(pdate1) and Val(Left(pAccountid,2))<9 tsql=[select sum(debit-credit) as balance from (']+dbclocation+[acctran') where accountid=']+paccountid+[' and date=9 wheretext=Alltrim(wheretext)+" And x.Date >= PDate1 " Endif USER_REPTSECLINE="FROM "+Dtoc(pdate1) Case Not Empty(pdate1) And Not Empty(pdate2) wheretext=Alltrim(wheretext)+" And BETWEEN(x.Date,pdate1,pdate2) " USER_REPTSECLINE="FROM "+Dtoc(pdate1)+" TO "+Dtoc(pdate2) Endcase If Not Empty(pAccountid) wheretext=Alltrim(wheretext)+" and x.Accountid=pAccountid " Endif If Not(Empty(wheretext)) wheretext=" where "+Substr(wheretext,5) Endif strhead=strhead+[

Account Ledger
] if not empty(USER_REPTSECLINE) strhead=strhead+[]+USER_REPTSECLINE+[
] endif personinfo=allt(theperson.name) if not empty(theperson.address1) personinfo=personinfo+[ ]+allt(theperson.address1) endif if not empty(theperson.address2) personinfo=personinfo+[ ]+allt(theperson.address2) endif if not empty(theperson.phone) personinfo=personinfo+[ ]+allt(theperson.phone) endif strhead=strhead+[]+personinfo+[

] tsql = ' Select x.transid,VAL(X.TRANSID) AS VTR, ' tsql=tsql+' x.vtype, x.date, x.desc, x.debit, x.credit, y.Accountid, y.Name ACNAME, y.Address1,y.extra as urduname,' tsql=tsql+' y.Address2, y.Email, y.Phone, y.Fax ' tsql=tsql+' from (dbclocation+[acctran]) x, (dbclocation+[Accounts]) y into cursor accountledger '+wheretext+ordertext &tsql Go Top If Not Eof() or not empty(openingbalances) THESTR=THESTR+''+Chr(13) THESTR=THESTR+[] THESTR=THESTR+[] THESTR=THESTR+[] THESTR=THESTR+[] THESTR=THESTR+[] THESTR=THESTR+[] THESTR=THESTR+[] THESTR=THESTR+[]+Chr(13) Endif DBL=0 If Not Empty(openingbalances) THESTR=THESTR+[]+[]+[] THESTR=THESTR+[] DBL=openingbalances If openingbalances>0 mdb=openingbalances THESTR=THESTR+[] THESTR=THESTR+[] Else mcr=abs(openingbalances) THESTR=THESTR+[] THESTR=THESTR+[] Endif THESTR=THESTR+''+Chr(13) Endif ** go Top do while not eof() THISTR=transid THISTP=vtype FIRSTTIME=.T. Do While TRANSID=THISTR And VTYPE=THISTP And Not Eof() *TO GET THE BRANCH CURRENCIES MDB=MDB+debit MCR=MCR+credit THESTR=THESTR+[]+Chr(13) If FIRSTTIME FIRSTTIME=.F. THESTR=THESTR+[]+[]+[] Else THESTR=THESTR+[]+[]+[] Endif THESTR=THESTR+[] If Empty(debit) THESTR=THESTR+[] Else THESTR=THESTR+[] Endif If Empty(credit) THESTR=THESTR+[] Else THESTR=THESTR+[] Endif DBL=DBL+debit-credit If DBL>0 THESTR=THESTR+[] Else THESTR=THESTR+[] Endif THESTR=THESTR+''+Chr(13) skip Enddo enddo THESTR=THESTR+[]+Chr(13)+; []+; []+; []+; [] If DBL>0 THESTR=THESTR+[] Else THESTR=THESTR+[] Endif THESTR=THESTR+''+Chr(13) THESTR=THESTR+'
DATEVOUCHRNUMBERDETAILS OF TRANSACTION]+DBO+[]+CBO+[]+LBO+[
]+Dtoc(PD1)+[  OPENING BALANCE]+Alltrim(Str(openingbalances,17,2))+[ ]+Alltrim(Str(openingbalances,17,2))+[ ]+Alltrim(Str(abs(openingbalances),17,2))+[]+Alltrim(Str(openingbalances,17,2))+[
]+Dtoc(Date)+[]+Alltrim(VTYPE)+[]+Alltrim(TRANSID)+[]+Alltrim(Desc)+[]+[]+Alltrim(Str(debit,17,2))+[]+[]+Alltrim(Str(credit,17,2))+[]+Alltrim(Str(DBL,17,2))+[]+Alltrim(Str(DBL,17,2))+[
]+LBO+[]+Alltrim(Str(MDB,17,2))+[]+Alltrim(Str(MCR,17,2))+[]+Alltrim(Str(DBL,17,2))+[]+Alltrim(Str(DBL,17,2))+[

'+Chr(13) THESTR=strhead+THESTR+strend %> <%=THESTR%>