Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: FBFHLX1

FBFHLX1.m

Go to the documentation of this file.
  1. FBFHLX1 ;WOIFO/SAB-TRANSMIT HL7 MESSAGES TO FPPS (CON'T) ;9/9/2003
  1. ;;3.5;FEE BASIS;**61,121,122**;JAN 30 1995;Build 8
  1. ;;Per VHA Directive 10-93-142, this routine should not be modified.
  1. Q
  1. ;
  1. CHKACK ; check for acknowledgements
  1. ; input - none
  1. ; output
  1. ; FBCNT("ACKT") - count of previously transmitted invoices w/o ack
  1. ; FBCNT("ACKA") - count of these that were accepted
  1. ; FBCNT("ACKR") - count of these that were rejected
  1. ; FBCNT("ACKW") - count of these that are still waiting for ack
  1. ; ^TMP($J,"FBNA",invoice number)="" - list waiting for ack
  1. ; update file 163.5
  1. N FBAAIN,FBMSGID,FBQDA,FBQY,FBSTATUS,FBX
  1. ;
  1. ; initialize
  1. K ^TMP($J,"FBNA")
  1. F FBX="ACKA","ACKR","ACKW" S FBCNT(FBX)=0
  1. ;
  1. ; loop thru transmitted (not yet acknowledged entries)
  1. S FBQDA=0 F S FBQDA=$O(^FBHL(163.5,"AC",1,FBQDA)) Q:'FBQDA D
  1. . S ^XTMP("FBFHLX","IEN")=$H_U_FBQDA_"^NYACK^" ; FB*3.5*122
  1. . S FBQY=$G(^FBHL(163.5,FBQDA,0))
  1. . S FBAAIN=$P(FBQY,U)
  1. . Q:FBAAIN="" ; invalid invoice number
  1. . S FBMSGID=$P(FBQY,U,4)
  1. . Q:FBMSGID=""
  1. . ;
  1. . S FBSTATUS=$$MSGSTAT^HLUTIL(FBMSGID)
  1. . ;
  1. . I $P(FBSTATUS,U)=3 D Q
  1. . . N FBFDA
  1. . . S FBFDA(163.5,FBQDA_",",2)="2" ; set status = acknowledged
  1. . . S FBFDA(163.5,FBQDA_",",8)="A" ; set ACK FLAG = ACCEPTED
  1. . . S FBFDA(163.5,FBQDA_",",9)=$P(FBSTATUS,U,2) ; set ACK DATE/TIME
  1. . . I $D(FBFDA) D FILE^DIE("","FBFDA")
  1. . . S FBCNT("ACKA")=FBCNT("ACKA")+1
  1. . ;
  1. . I $P(FBSTATUS,U)=4 D Q
  1. . . N FBFDA,FBTXT
  1. . . S FBFDA(163.5,FBQDA_",",2)="2" ; set status = acknowledged
  1. . . S FBFDA(163.5,FBQDA_",",8)="R" ; set ACK FLAG = rejected
  1. . . S FBFDA(163.5,FBQDA_",",9)=$P(FBSTATUS,U,2) ; set ACK DATE/TIME
  1. . . S FBFDA(163.5,FBQDA_",",10)="N" ; rej status = not reported
  1. . . I $D(FBFDA) D FILE^DIE("","FBFDA")
  1. . . S FBTXT(1)=$P(FBSTATUS,U,3)
  1. . . I FBTXT(1)]"" D WP^DIE(163.5,FBQDA_",",11,"","FBTXT") ; error msg
  1. . . S FBCNT("ACKR")=FBCNT("ACKR")+1
  1. . ;
  1. . ; don't report not acknowledged unless it is last entry for invoice
  1. . Q:$$LAST^FBFHLU($P(FBQY,U))'=FBQDA
  1. . ;
  1. . ; last entry for invoice was not acknowledged yet
  1. . S ^TMP($J,"FBNA",FBAAIN)=""
  1. . S FBCNT("ACKW")=FBCNT("ACKW")+1
  1. ;
  1. S FBCNT("ACKT")=FBCNT("ACKA")+FBCNT("ACKR")+FBCNT("ACKW")
  1. ;
  1. Q
  1. ;
  1. SUMMSG ; Summary Message (build and send)
  1. ; input
  1. ; ^TMP($J,"FBE",invoice number,seq number)=error text
  1. ; ^TMP($J,"FBW",invoice number,seq number)=warning text
  1. ; ^TMP($J,"FBNA",invoice number)="" for invoices not acknowledged
  1. ; ^TMP($J,"FBX",seq number)=message text so far
  1. ; FBXL = last line used in ^TMP($J,"FBX",seq number)
  1. ; FBXMIT("START") = start process, FileMan date/time
  1. ; FBXMIT("ACK") = start check for acks, FileMan date/time
  1. ; FBXMIT("SEND") = start transmit, FileMan date/time
  1. ; FBXMIT("END") = end process, FileMan date/time
  1. ; FBCNT("PENDT")= count of pending invoices that were transmitted
  1. ; FBCNT("PENDE")= count of pending invoices that had exception
  1. ; FBCNT("ACKT") = count of previously transmitted invoices w/o ack
  1. ; FBCNT("ACKA") = count of these that were accepted
  1. ; FBCNT("ACKR") = count of these that were rejected
  1. ; FBCNT("ACKW") = count of these that are still waiting for ack
  1. ; output
  1. ; ^TMP($J,"FBX",
  1. ; mail message
  1. ;
  1. N XMDUZ,XMSUB,XMTEXT,XMY,XMZ
  1. ;
  1. ; add header text
  1. S ^TMP($J,"FBX",1)=$$FMTE^XLFDT(FBXMIT("START"))_" Process Started."
  1. S ^TMP($J,"FBX",2)=$$FMTE^XLFDT(FBXMIT("ACK"))_" Check transmitted messages for acknowledgement..."
  1. S ^TMP($J,"FBX",3)=" "_FBCNT("ACKT")_" previously transmitted messages w/o ack."
  1. S ^TMP($J,"FBX",4)=" "_FBCNT("ACKA")_" of these were accepted."
  1. S ^TMP($J,"FBX",5)=" "_FBCNT("ACKR")_" of these were rejected."
  1. S ^TMP($J,"FBX",6)=" "_FBCNT("ACKW")_" of these still waiting for ack."
  1. S ^TMP($J,"FBX",7)=$$FMTE^XLFDT(FBXMIT("SEND"))_" Transmit pending invoices..."
  1. S ^TMP($J,"FBX",8)=" "_FBCNT("PENDT")_" transmitted."
  1. S ^TMP($J,"FBX",9)=" "_FBCNT("PENDE")_" not transmitted due to exception."
  1. S ^TMP($J,"FBX",10)=$$FMTE^XLFDT(FBXMIT("END"))_" Process Complete."
  1. I $D(ZTSTOP) S ^TMP($J,"FBX",11)=" Process (task) stopped due to user request."
  1. I $D(FBCNT("10K")) S ^TMP($J,"FBX",12)=" Process (task) stopped due to reaching 10K message limit." ; FB*3.5*121
  1. ;
  1. ; List Exceptions
  1. I FBCNT("PENDE")>0 D
  1. . N FBAAIN,FBL,FBX
  1. . D PTXT(.FBXL," ")
  1. . D PTXT(.FBXL,"List of Exceptions during Transmit of Pending Invoices")
  1. . S FBAAIN="" F S FBAAIN=$O(^TMP($J,"FBE",FBAAIN)) Q:FBAAIN="" D
  1. . . D PTXT(.FBXL,"Invoice: "_FBAAIN)
  1. . . S FBL=0 F S FBL=$O(^TMP($J,"FBE",FBAAIN,FBL)) Q:'FBL D
  1. . . . S FBX=$G(^TMP($J,"FBE",FBAAIN,FBL))
  1. . . . I FBX]"" D PTXT(.FBXL," "_FBX)
  1. ;
  1. ; List Invoices Waiting for Ack
  1. I FBCNT("ACKW")>0 D
  1. . N FBAAIN
  1. . D PTXT(.FBXL," ")
  1. . D PTXT(.FBXL,"List of Invoices Waiting for Acknowledgement")
  1. . S FBAAIN="" F S FBAAIN=$O(^TMP($J,"FBW",FBAAIN)) Q:FBAAIN="" D
  1. . . D PTXT(.FBXL,"Invoice: "_FBAAIN)
  1. ;
  1. ; Report Rejected Acks
  1. I $D(^FBHL(163.5,"ARS","N")) D
  1. . N FBAAIN,FBFDA,FBI,FBQDA,FBTXT,FBWP,FBX
  1. . D PTXT(.FBXL," ")
  1. . D PTXT(.FBXL,"List of Rejected Invoices that have not been reported.")
  1. . S FBQDA=0 F S FBQDA=$O(^FBHL(163.5,"ARS","N",FBQDA)) Q:'FBQDA D
  1. . . S FBQY=$G(^FBHL(163.5,FBQDA,0))
  1. . . S FBAAIN=$P(FBQY,U)
  1. . . D PTXT(.FBXL,"Invoice: "_FBAAIN)
  1. . . ;
  1. . . K FBWP
  1. . . S FBX=$$GET1^DIQ(163.5,FBQDA_",",11,"","FBWP")
  1. . . S FBI=0 F S FBI=$O(FBWP(FBI)) Q:'FBI D
  1. . . . S FBTXT=FBWP(FBI)
  1. . . . D PTXT(.FBXL," "_FBTXT)
  1. . . ;
  1. . . K FBFDA
  1. . . S FBFDA(163,FBQDA_",",10)="R" ; set reject status = reported
  1. . . I $D(FBFDA) D FILE^DIE("","FBFDA")
  1. ;
  1. D PTXT(.FBXL," ")
  1. D PTXT(.FBXL,"END OF SUMMARY MESSAGE")
  1. ;
  1. ; send message
  1. S XMSUB="FEE BASIS FPPS Transmit "_$$FMTE^XLFDT(FBXMIT("START"),"DF")
  1. S XMDUZ="FEE BASIS"
  1. S XMY("G.FEE")=""
  1. S XMTEXT="^TMP($J,""FBX"","
  1. D ^XMD
  1. Q
  1. ;
  1. PTXT(FBXL,FBTXT) ; Post line of text in global array for summary message
  1. ; input
  1. ; FBXL - last line number used, passed by reference
  1. ; FBTXT - line of text
  1. ; output
  1. ; FBXL - increments value by 1
  1. ; ^TMP($J,"FBX",input line+1)=text
  1. ;
  1. S FBXL=FBXL+1
  1. S ^TMP($J,"FBX",FBXL)=FBTXT
  1. ;
  1. Q
  1. ;
  1. ;FBFHLX1