*ThisForm.cmdF50Hsinglerenewal.RightClick() * button that sends report to print server via psreqrpt (Printserver Request Rpt) LOCAL nStateID, cLocName, cKeyFields IF Address.KeyFld = F50H.KeyFld cLocName = ALLTRIM(F50H.WholeName) IF MESSAGEBOX("Print a SINGLE F50H Renewal Form for "+cLocName+"?",MB_ICONQUESTION+MB_YESNO,"F50E Renewal Printout") <> IDYES RETURN ENDIF IF NOT((F50H.STATUS = 1 OR F50H.STATUS = 7 OR F50H.STATUS = 2)) =MESSAGEBOX("Invalid license status") RETURN ENDIF cKeyFields = ALLTRIM(STR(F50H.KeyFld))+","+ALLTRIM(STR(F50H.IndivKey)) IF THISFORM.psreqrpt(gcNameX, "Sfrm50H", , cKeyFields) =MESSAGEBOX("Request for FORM50H Renewal printout sent to the Print Server") SELECT Address REPLACE Address.roster WITH .T. IF NOT TABLEUPDATE(.F.,.T.,"ADDRESS") =TABLEREVERT(.F.,"ADDRESS") =MESSAGEBOX("Roster Flag NOT set TRUE... Call Jerry") ENDIF ELSE =MESSAGEBOX("Error sending request to the Print Server") ENDIF ENDIFHere is THISFORM.psreqrpt()
*ThisForm.PSReqRpt() * This method was written by JP and requires that a PC in Gaming be running * the PSPRINT print server app. This app watches for print requests and generates * them using report forms created by Crystal Report Writer 7.0. JP Kreps has the * only licensed copy of CRW7, which requires files be in the Fox2X format. * LPARAMETERS ; tcUserName, ; tcReportName, ; tcRequestFileName, ; txKeyField LOCAL ; lcFileName, ; lcKeyField, ; lcDataLine, ; lnFileHandle, ; llSuccess llSuccess = .T. lcFileName = SYS(5) + sys(2003) + "\psfiles\" *!* If the txKeyField parameter is passed, then a report was requested for one or more *!* specific entities. If the third parameter is absent, then a bulk report was *!* requested. IF VARTYPE(txKeyField) <> "L" IF VARTYPE(txKeyField) = "C" lcKeyField = "C*" + ALLTRIM(txKeyField) ELSE IF VARTYPE(txKeyField) = "N" lcKeyField = "N*" + ALLTRIM(STR(txKeyField)) ELSE llSuccess = .F. ENDIF ENDIF ELSE lcKeyField = "BULK REPORT" ENDIF IF llSuccess *!* Note: 08/18/99. tcRequestFileName (used to be "none") has been deactivated. *!* If the tcRequestFileName is passed, it is used as the request file name and the *!* request is considered to be part of a shell report request. *!* If the tcRequestFileName is not passed, the request file name is composed of *!* the last four numbers OF the user's revid and four random characters and the *!* request is considered to be an independent report request. IF VARTYPE(tcRequestFileName) == "L" lcFileName = lcFileName + SUBSTR(tcUserName, 4) + SUBSTR(SYS(2015), 7) + ".txt" ELSE lcFileName = lcFileName + tcRequestFileName + ".txt" ENDIF lcDataLine = tcReportName + ":" + lcKeyField lnFileHandle = FCREATE(lcFileName, 0) IF lnFileHandle = -1 llSuccess = .F. ENDIF ENDIF IF llSuccess IF FPUTS(lnFileHandle, lcDataLine) = 0 llSuccess = .F. ENDIF ENDIF IF llSuccess IF NOT FFLUSH(lnFileHandle) llSuccess = .F. ENDIF ENDIF IF llSuccess IF NOT FCLOSE(lnFileHandle) llSuccess = .F. ENDIF ENDIF IF NOT llSuccess = MESSAGEBOX("Could not inform print server." + CHR(13) + ; "Error Code: " + ALLTRIM(STR(FERROR())) + CHR(13) + ; MB_ICONSTOP + MB_OK, "Error") ENDIF RETURN llSuccessThe PrintServer program is very big, but I'll send you a copy if you wish.