MEMBER('lmsreceipts.clw') ! This is a MEMBER module Main PROCEDURE LocalRequest LONG OriginalRequest LONG LocalResponse LONG FilesOpened LONG WindowOpened LONG WindowInitialized LONG ForceRefresh LONG Window WINDOW('Receipt Generation'),AT(,,63,1),GRAY END numstar LONG StopPos LONG NewString STRING(1024) ResultArr STRING(200) DIM(10) CODE PUSHBIND data_rcpdta = 'C:\advantumreports\rcpdata.txt' data_bldtl = 'C:\advantumreports\bldtl.tps' data_contdtl= 'C:\advantumreports\contdtl.tps' data_chgdtl = 'C:\advantumreports\chgdtl.tps' LocalRequest = GlobalRequest OriginalRequest = GlobalRequest LocalResponse = RequestCancelled ForceRefresh = False CLEAR(GlobalRequest) CLEAR(GlobalResponse) IF KEYCODE() = MouseRight SETKEYCODE(0) END DO PrepareProcedure ACCEPT CASE EVENT() OF EVENT:OpenWindow IF NOT WindowInitialized DO InitializeWindow WindowInitialized = True END SELECT(1) OF EVENT:GainFocus ForceRefresh = True IF NOT WindowInitialized DO InitializeWindow WindowInitialized = True ELSE DO RefreshWindow END OF Event:Rejected BEEP DISPLAY(?) SELECT(?) END END DO ProcedureReturn !--------------------------------------------------------------------------- PrepareProcedure ROUTINE IF BLDetails::Used = 0 CheckOpen(BLDetails,1) END BLDetails::Used += 1 BIND(BLDTL:RECORD) IF ChargesDetail::Used = 0 CheckOpen(ChargesDetail,1) END ChargesDetail::Used += 1 BIND(CHGSDTL:RECORD) IF ContainerDetail::Used = 0 CheckOpen(ContainerDetail,1) END ContainerDetail::Used += 1 BIND(CONDTL:RECORD) IF RcpData::Used = 0 CheckOpen(RcpData,0) END RcpData::Used += 1 BIND(RCPDAT:RECORD) FilesOpened = True OPEN(Window) WindowOpened=True DO ReadReceiptData PrintReceipt() DO ProcedureReturn !--------------------------------------------------------------------------- ProcedureReturn ROUTINE !| !| This routine provides a common procedure exit point for all template !| generated procedures. !| !| First, all of the files opened by this procedure are closed. !| !| Next, if it was opened by this procedure, the window is closed. !| !| Next, GlobalResponse is assigned a value to signal the calling procedure !| what happened in this procedure. !| !| Next, we replace the BINDings that were in place when the procedure initialized !| (and saved with PUSHBIND) using POPBIND. !| !| Finally, we return to the calling procedure. !| IF FilesOpened BLDetails::Used -= 1 IF BLDetails::Used = 0 THEN CLOSE(BLDetails). ChargesDetail::Used -= 1 IF ChargesDetail::Used = 0 THEN CLOSE(ChargesDetail). ContainerDetail::Used -= 1 IF ContainerDetail::Used = 0 THEN CLOSE(ContainerDetail). RcpData::Used -= 1 IF RcpData::Used = 0 THEN CLOSE(RcpData). END REMOVE(BLDetails) REMOVE(ChargesDetail) REMOVE(ContainerDetail) IF WindowOpened CLOSE(Window) END IF LocalResponse GlobalResponse = LocalResponse ELSE GlobalResponse = RequestCancelled END POPBIND RETURN !--------------------------------------------------------------------------- InitializeWindow ROUTINE !| !| This routine is used to prepare any control templates for use. It should be called once !| per procedure. !| DO RefreshWindow !--------------------------------------------------------------------------- RefreshWindow ROUTINE !| !| This routine is used to keep all displays and control templates current. !| IF Window{Prop:AcceptAll} THEN EXIT. DISPLAY() ForceRefresh = False !--------------------------------------------------------------------------- SyncWindow ROUTINE !| !| This routine is used to insure that any records pointed to in control !| templates are fetched before any procedures are called via buttons or menu !| options. !| !--------------------------------------------------------------------------- ReadReceiptData ROUTINE SET(RcpData) LOOP NEXT(RcpData) IF ERRORCODE() THEN BREAK. IF (SUB(RCPDAT:line,1,3)= 'HDR') numstar = 10 DO SplitLine GLO:Rcpnbr = DEFORMAT(ResultArr[2]) GLO:RcpDate = DEFORMAT(ResultArr[3],@d12) GLO:RcpTime = DEFORMAT(ResultArr[4],@t4) GLO:RcpCur = CLIP(ResultArr[5]) GLO:RcpUser = CLIP(ResultArr[6]) GLO:RCPCustomer = CLIP(ResultArr[7]) GLO:CustomerAddress = ReplaceString(CLIP(ResultArr[8]),'&^#%','<13><10>') GLO:CusTot = DEFORMAT(ResultArr[9]) GLO:ReprintFlag = UPPER(CLIP(ResultArr[10])) END IF (SUB(RCPDAT:line,1,2)= 'BL') numstar = 8 DO SplitLine CLEAR(BLDTL:RECORD) BLDTL:bilref = DEFORMAT(ResultArr[2]) BLDTL:bilno = CLIP(ResultArr[3]) BLDTL:linename= CLIP(ResultArr[4]) BLDTL:shipname = CLIP(ResultArr[5]) BLDTL:reportdate= DEFORMAT(ResultArr[6],@d12) BLDTL:voynum = CLIP(ResultArr[7]) BLDTL:consigname= CLIP(ResultArr[8]) ADD(BLDetails) END IF (SUB(RCPDAT:line,1,3)= 'CTN') numstar = 3 DO SplitLine CLEAR(CONDTL:Record) CONDTL:bilref = DEFORMAT(ResultArr[2]) CONDTL:contnbr = CLIP(ResultArr[3]) ADD(ContainerDetail) END IF (SUB(RCPDAT:line,1,3)= 'DTL') numstar = 5 DO SplitLine CLEAR(CHGSDTL:RECORD) CHGSDTL:bilref = DEFORMAT(ResultArr[2]) CHGSDTL:chgdesc = CLIP(ResultArr[3]) CHGSDTL:amount = DEFORMAT(ResultArr[4]) CHGSDTL:amountdc = DEFORMAT(ResultArr[5]) ADD(ChargesDetail) END IF (SUB(RCPDAT:line,1,5)= 'PYDTL') numstar = 2 DO SplitLine Glo:PayStr = CLIP(ResultArr[2]) END END SplitLine ROUTINE StopPos = 0 NewString = RCPDAT:line I# = 1 LOOP numstar TIMES IF INSTRING('*', NewString, 1, 1) ResultArr[I#] = SUB(NewString,1,INSTRING('*', NewString, 1, 1)-1) ELSE ResultArr[I#] =NewString NewString = '' END I#+=1 StopPos = INSTRING('*', NewString, 1, 1) NewString = SUB(NewString,StopPos+1,len(NewString) - StopPos) END PrintReceipt PROCEDURE RejectRecord LONG LocalRequest LONG LocalResponse LONG WindowOpened LONG RecordsToProcess LONG,AUTO RecordsProcessed LONG,AUTO RecordsPerCycle LONG,AUTO RecordsThisCycle LONG,AUTO PercentProgress BYTE RecordStatus BYTE,AUTO FilesOpened LONG PRINT::VGEDtl BYTE PRINT::BOLDtl BYTE PRINTED::BolDtl BYTE Container1 STRING(20) Container2 STRING(20) Container3 STRING(20) Container4 STRING(20) Container5 STRING(20) Container6 STRING(20) !----------------------------------------------------------------------------- Process:View VIEW(ChargesDetail) PROJECT(CHGSDTL:amount) PROJECT(CHGSDTL:chgdesc) END !-------------------------------------------------------------------------- ! Tinman Report Viewer !-------------------------------------------------------------------------- TintRptViewer TinReportViewer !-------------------------------------------------------------------------- ! Tinman Report Viewer !-------------------------------------------------------------------------- report REPORT,AT(125,2302,8063,2333),PAPER(PAPER:USER,8500,5500),PRE(RPT),THOUS HEADER,AT(115,469,8063,1833) STRING('CUSTOMER'),AT(1688,323,781,198),USE(?String23),TRN,FONT('Times New Roman',10,,FONT:bold) STRING('DATE'),AT(615,823,417,177),USE(?String33),TRN,FONT('Times New Roman',10,,FONT:bold) STRING('RECEIPT'),AT(344,323),USE(?String32),TRN,FONT('Times New Roman',12,,FONT:bold) LINE,AT(344,521,1042,0),USE(?Line12),COLOR(COLOR:Black) STRING(@P<<<<<<<<<
BadRecErr StandardWarning(Warn:RecordFetchError,'ContainerDetail') END LocalResponse = RequestCancelled EXIT ELSE LocalResponse = RequestCompleted END RecordsProcessed += BYTES(ChargesDetail) RecordsThisCycle += BYTES(ChargesDetail) IF PercentProgress < 100 PercentProgress = (RecordsProcessed / RecordsToProcess)*100 IF PercentProgress > 100 PercentProgress = 100 END IF PercentProgress <> Progress:Thermometer THEN Progress:Thermometer = PercentProgress ?Progress:PctText{Prop:Text} = FORMAT(PercentProgress,@N3) & '% Completed' DISPLAY() END END ReplaceString FUNCTION (strInputString,strSearchString,strReplaceString) ! Declare Procedure ReturnString STRING(1024) SearchStringPosition LONG LastStringPosition LONG CODE ! Begin processed code CLEAR(ReturnString) SearchStringPosition = 1 LastStringPosition = 1 LOOP SearchStringPosition = INSTRING(CLIP(strSearchString), strInputString, 1, LastStringPosition) IF SearchStringPosition ReturnString = CLIP(ReturnString) & SUB(strInputString, LastStringPosition, (SearchStringPosition-LastStringPosition)) & CLIP(strReplaceString) LastStringPosition = SearchStringPosition + LEN(CLIP(strSearchString)) IF LastStringPosition > LEN(CLIP(strInputString)) BREAK END ELSE ReturnString = CLIP(ReturnString) & SUB(strInputString, LastStringPosition, (LEN(CLIP(strInputString))-LastStringPosition+1)) BREAK END END If SUB(ReturnString,1,2)= ' ' ReturnString = SUB(ReturnString,3,LEN(CLIP(ReturnString))-2) END RETURN(ReturnString)