******************************************************************************************* * Description.......: ReportToAscii - this program uses ReportFile as Input Table * and results a program to produce the same Output (as Report should produce) * Calling Samples...: ReportToAscii("Galley","g:\redp\appl\Special\Progs\GalleyRpt.prg") * Parameter List....: tcReportFile, tcProgramFile * Created by........: Nadya Nosonovsky 12/22/2000 10:09:26 AM * Modified by.......: ******************************************************************************************** lparameters tcReportFile, tcProgramFile local lcReportName, lcProgramName, lnAnswer if vartype(tcReportFile)<>'C' or empty(m.tcReportFile) lcReportName=getfile("FRX") else lcReportName=forceext(m.tcReportFile,"frx") endif if empty(m.lcReportName) return .f. endif if !file(m.lcReportName) && Report file doesn't exist =messagebox("File "+m.lcReportName+" is not found!",48,"Error") return .f. endif if empty(m.tcProgramFile) or vartype(m.tcProgramFile)<>'C' lcProgramName=getfile("PRG") else lcProgramName=forceext(m.tcProgramFile,"prg") endif if file(m.lcProgramName) lnAnswer=messagebox("File "+m.lcProgramName+ " already exists. Do you want to re-create it?",36,"File exists") if m.lnAnswer=7 && No return .f. else erase (m.lcProgramName) endif endif local lcStr, lcHeader, lcBegin, lcEnd select expr, supexpr, vpos, hpos from (lcReportName) ; into cursor curReport where inlist(objtype,5,8) order by 3,4 #define LCRF chr(10) lcStr='' lcHeader="#define LCRF chr(10)"+LCRF+"local lcStr"+LCRF+"* Open table here, then scan ... endscan ..."+LCRF lcBegin="lcStr=lcStr+" lcEnd="+LCRF" scan if not empty(supexpr) lcStr=m.LcStr+"if "+alltrim(supexpr)+LCRF+ ; space(6)+m.lcBegin+alltrim(expr)+m.lcEnd+LCRF+"endif"+LCRF else lcStr=m.LcStr+m.lcBegin+alltrim(expr)+m.lcEnd+LCRF endif endscan *=messagebox(lcStr) =strtofile(m.lcHeader+lcStr,m.lcProgramName)Here is a program produced by this program and then modified
******************************************************************** * Description.......: GalleyRpt - Special program to produce Galley Report * Calling Samples...: GalleyRpt(oJC.outTable) * Parameter List....: tcTableName * Created by........: Nadya Nosonovsky 12/21/2000 03:18:59 PM * Modified by.......: Nadya Nosonovsky 01/05/2001 04:38:46 PM ******************************************************************** lparameters tcTableName wait window nowait "Wait while Ouput file is generating..." if empty(m.tcTableName) tcTableName="\Redp\Output\Galley\GalleyMA0008Tstr" && For tests only endif local lcStr, lcDBFName, lcFileName, lnOldSelect, lcRegistry, lcCity, ; llFirstTime, lnRecGrp, lcState lnOldSelect=select() lcDBFName=forceext(m.tcTableName,"dbf") lcFileName=forceext(m.tcTableName,"rer") local lloJCExist lloJCExist=.f. if file(m.lcFileName) erase (m.lcFileName) endif if !UseTble(m.lcDBFName,"WorkTable","shared noupdate","geo") return .f. endif select WorkTable if vartype(oJC)="O" lloJCExist=.t. ojc.extension='.rer' oJC.StepRecCount=reccount() lcState = oJC.CurState else lcState = "MA" endif *suspend if reccount("WorkTable")=0 use in WorkTable select (m.lnOldSelect) wait window nowait "No records to produce an output..." return .f. endif local TABC, CRLF CRLF = chr(13)+chr(10) TABC = chr(9) lcRegistry=Registry lcCity=City llFirstTime=.t. lnRecGrp=RecGrp lcStr='' scan if m.lcRegistry<>Registry or m.llFirstTime && Registry group Header lcStr= m.lcStr+iif(m.lcState="CT",'@CTHD:','')+alltrim(Registry)+CRLF lcRegistry=Registry *!* if m.lcState="MA" *!* if !empty(lcBegDate) or !empty(lcEndDate) or !empty(rdBegDate) or !empty(rdEndDate) *!* lcStr= m.lcStr+"@Filing Dates:This Week's Filing Dates"+CRLF *!* endif *!* if !empty(rdBegDate) or !empty(rdEndDate) *!* lcStr= m.lcStr+'@Records Filed:Registry of Deeds:'+alltrim(rdBegDate)+'-'+alltrim(rdEndDate)+CRLF *!* endif *!* if !empty(lcBegDate) or !empty(lcEndDate) *!* lcStr= m.lcStr+'@Records Filed:Land Court:'+alltrim(lcBegDate)+'-'+alltrim(lcEndDate)+CRLF *!* endif *!* endif endif if m.lcCity<>City or m.llFirstTime && City group Header lcStr= m.lcStr+iif(m.lcState="CT",'@CTTOWN:',"@Records Town Head:")+alltrim(City)+CRLF if !empty(TClerkName) lcStr = m.lcStr+'@TC Label:Town Clerk:'+alltrim(TClerkName)+CRLF endif if !empty(TClAddress) lcStr = m.lcStr+'@Clerk Address:'+alltrim(TClAddress)+CRLF endif if !empty(TClPhone) lcStr= m.lcStr+'@Clerk Address:Phone:'+alltrim(TClPhone) + CRLF endif lcStr= m.lcStr+'@Mkt. Stats:Market Statistics Through '+alltrim(cEndMonth)+CRLF lcStr= m.lcStr+'@Records Mkt. Stats:'+TABC+TABC+'YTD '+cPrevYear+TABC+'YTD '+cCurYear+CRLF lcStr= m.lcStr+TABC+'Number of '+iif(lcState='MA','1Fam','1-4Fam')+' Sales'+TABC+alltrim(transform(YtdNumPrev,'@ 999,999'))+TABC+ ; alltrim(transform(YtdNumCur,'@ 999,999'))+CRLF lcStr= m.lcStr+'@Records Mkt. Stats Fin:'+ TABC + "Median Price" + TABC+ ; alltrim(transform(YtdMedPrev,'@Z$ 999,999,999'))+ TABC+ ; alltrim(transform(YtdMedCur,'@Z$ 999,999,999')) + CRLF lcCity=City lnRecGrp=0 && when the city changes, blank out the RecGrp so that a new RecGrp header prints in new city AP 12/04/01 endif if m.lnRecGrp<>RecGrp or m.llFirstTime && Record Group Header lcStr= m.lcStr+'@Records R. E. Sales:<f"EuropeanPi-Four">P<f"Helvetica">'+iif(RecGrp=1,'Real Estate Sales',iif(RecGrp=2,'Foreclosure Deeds','Mortgages'))+CRLF lnRecGrp=RecGrp endif llFirstTime=.f. && Now it's not a first time (all Headers are already printed) ***** Proceed with detail band if RecGrp<3 lcStr= m.lcStr+'@Records First Line:'+alltrim(Address)+TABC+ ; iif(Price>=1000,transform(Price,'@Z$ 999,999,999'),'')+ ; iif(Price=3," No Amount Given","")+CRLF endif if RecGrp=3 lcStr= m.lcStr+'@Records First Line:'+alltrim(Address)+TABC+ ; transform(Mortgage,'@Z$ 999,999,999')+ ; iif(Mortgage=0 and !empty(LndrName)," No Amount Given","")+CRLF endif if RecGrp<3 and !empty(CondoName) lcStr= m.lcStr+'@Records Text:'+TABC+alltrim(CondoName)+CRLF endif if RecGrp<3 and !empty(cmboBuyer) lcStr= m.lcStr+'@Records Text:'+TABC+alltrim(cmboBuyer)+CRLF endif if RecGrp<3 and !empty(CmboSeller) lcStr= m.lcStr+'@Records Text:'+TABC+alltrim(CmboSeller)+CRLF endif if RecGrp<3 and !empty(DocCombo) lcStr= m.lcStr+TABC+alltrim(DocCombo)+CRLF endif if RecGrp<3 and !empty(LndrName) lcStr= m.lcStr+TABC+"Mtg: "+alltrim(LndrName)+" "+alltrim(transform(Mortgage,"@Z$ 999,999,999"))+ ; iif(Mortgage=0 and !empty(LndrName)," No Amount Given","")+CRLF endif if RecGrp=3 and !empty(Borrowing) lcStr= m.lcStr+'@Records Text:'+TABC+Borrowing+CRLF endif if !empty(prTerm) or !empty(prRate) or !empty(prIntType) lcStr= m.lcStr+TABC+alltrim(prTerm)+' '+alltrim(prRate)+' '+alltrim(prIntType)+CRLF endif if !empty(MtgAssigne) lcStr= m.lcStr+iif(!empty(MtgAssigne) and left(MtgAssigne,11)='Assn of Mtg',TABC+'Mtg Assn to: '+ltrim(substr(MtgAssigne,12)),'')+CRLF endif if RecGrp<3 and !empty(PropCombo) lcStr= m.lcStr+TABC+PropCombo+CRLF endif if RecGrp<3 and (!empty(PrSlPr) or !empty(PrDate)) lcStr= m.lcStr+TABC+"Prior Sale: "+alltrim(transform(PrSlPr,'@Z$ 999,999,999'))+ ; " "+PrDate+CRLF endif if len(m.lcStr)>16770000 && Large file =strtofile(m.lcStr,m.lcFileName,.t.) lcStr='' && Start again endif endscan =strtofile(m.lcStr,m.lcFileName,.t.) use in select('WorkTable') select (m.lnOldSelect) && Return back wait clear return .t.