*-------------------------------------------------------------------------- * -- Printing a Report from FilingDate table *-------------------------------------------------------------------------- * Nadya Nosonovsky 02/26/2002 03:07:12 PM local tmpSaveRecno, lcIssue, lcStateWeek, lnSelect, lcState, ldDate, ; lcOlderWeek, lnTally, llAutoYield llAutoYield = _VFP.AutoYield *_VFP.AutoYield = .f. private NumPages set message to 'Wait while report is preparing...' NumPages = "" && 0 lnSelect = select() #define CRLF chr(13)+chr(10) wait window nowait 'Wait while preparing data for the report...' SET LIBRARY TO cppTimer.fll ADDITIVE *-- initialize timer *!* lnMilliSecs = 200 && adjust *!* InitTimers(1, lnMilliSecs) *!* SetupTimer (1, lnMilliSecs, "DOEVENTS") *-- processing goes here with thisform tmpSaveRecno = recno('BatchCntrl') lcStateWeek = .ThisState + .ThisIssue lcState = .ThisState lcIssue = .ThisIssue lcOlderWeek = m.lcState + '198001' && Hardcoded earliest possible date if ProduceFilingDateSQL(m.lcOlderWeek,m.lcStateWeek,m.lcState) wait window nowait 'Wait while PDF is being created...' set message to 'Wait while PDF is being created...' if not directory('\Redp\Output\Products\Intranet') md ('\Redp\Output\Products\Intranet') endif local lcPDF lcPDF = '\Redp\Output\Products\Intranet\' + .ThisState +"Filing.PDF" set printer to default if CreatePDF(m.lcPDF) local loControl, lcAviFile set message to 'Wait while PDF is being created...' report form MFilingDates to printer noconsole set printer to default loControl = newobject( "AnimationControl", 'CommCtrl.vcx') loControl.InStatusBar = .t. loControl.autoopen = .f. && .Move() doesn't work for "instatusbar" controls loControl.left = 200 loControl.top = 5 local lnReturn, lcText, lcUserName lcUserName = iif(vartype(oJC)='O' and !empty(oJC.UserName), ; oJC.UserName,'Nadya Nosonovsky') mouse at mrow(), mcol() doevents() if file(m.lcPDF) if vartype(oJC)='O' and oJC.LiveSys && Don't FTP for Development&& File was produced ok set message to "Wait while sending the file through FTP..." wait window nowait "Wait while sending the file through FTP..." && Updated:NN: 03/07/02 - will try to send it through ftp to our Intranet local lcUserID, lcPassword, lcFtpAddr, lcFtpPath loControl.Recreate() lcAviFile = addbs(justpath(fullpath('CommCtrl.vcx')))+'AVIs\Move.avi' loControl.open(m.lcAviFile) .oAnimation = m.loControl if ftpOption (m.lcUserID,m.lcPassword,m.lcFtpAddr,m.lcPDF,justfname(m.lcPDF),m.lcFtpPath, .f.)<>".T." && Error occurs wait window nowait 'Wait while sending e-mail to Tim, since FTP failed...' set message to 'Wait while sending e-mail to Tim, since FTP failed...' lcText = "Hi Tim, " + CRLF + CRLF + ; "File "+ m.lcPDF + " was just produced." + CRLF + CRLF + ; "You now need to place it on the company Intranet." + CRLF + CRLF + CRLF + ; "Sincerely yours, " + CRLF + m.lcUserName + CRLF + CRLF + CRLF + ; iif(vartype(oJC)='O' and oJC.LiveSys,"Live","This is just a test") lnReturn = IDSEMail('Geiss','Wellcome new Filing Dates file',m.lcText) endif .oAnimation.close() .oAnimation.visible = .f. .oAnimation = null endif if m.lcState = "MA" && For now do it for MA only wait window nowait 'Wait while sending e-mail...' set message to 'Sending e-mail...' * loControl.AutoPlay = .T. loControl.Recreate() lcAviFile = addbs(justpath(fullpath('CommCtrl.vcx')))+'AVIs\SndMail2.avi' loControl.open(m.lcAviFile) loControl.Play( 0, -1, -1) .oAnimation = m.loControl .oAnimation.visible = .t. lcText = 'Hi everybody, '+ CRLF + CRLF+ ; "Attached please find Filing Dates Report " + CRLF + CRLF + CRLF + ; "Sincerely yours, " + CRLF + m.lcUserName + CRLF + CRLF + CRLF + ; iif(vartype(oJC)='O' and oJC.LiveSys,"","This is just a test") local lcUsersAddresses if vartype(oJC)='O' and oJC.LiveSys lcUsersAddresses = else lcUsersAddresses = [Nosonovsky] endif lnReturn = IDSEMail(m.lcUsersAddresses, ; m.lcState+' Filing Dates report for Issue '+ m.lcIssue, ; m.lcText, m.lcPDF) * =inkey(0) .oAnimation.close() loControl.close() .oAnimation.visible = .f. .oAnimation = null endif endif set message to "" dodefault() && Nadya Nosonovsky 01/09/2002 03:36:45 PM Causes problems, so I commented it out for now endif endif use in curPrint select (m.lnSelect) if between(m.tmpSaveRecno,1,reccount('BatchCntrl')) goto m.tmpSaveRecno in BatchCntrl endif endwith _VFP.AutoYield = m.llAutoYield *-- Stop timer *!* StopTimer(1) *!* KillTimers()>Nadya,
>SET LIBRARY TO cppTimer.fll ADDITIVE >*-- initialize timer >lnMilliSecs = 200 && adjust >InitTimers(1, lnMilliSecs, "DOEVENTS") > >*-- processing goes here > >*-- Stop timer >StopTimer(1) >KillTimers() >>