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

RCDPXPAM.m

Go to the documentation of this file.
  1. RCDPXPAM ;WISC/RFJ-auto process payments, message generation ;1 Jun 99
  1. ;;4.5;Accounts Receivable;**114,153**;Mar 20, 1995
  1. ;;Per VHA Directive 10-93-142, this routine should not be modified.
  1. Q
  1. ;
  1. ;
  1. ERROR(RCDPDATE,RCDPXMZ,ERROR) ; reply to server message with error
  1. ; pass ^tmp($j,"rcdpxpay","error",#) for additional/multiple errors
  1. N LINE,MESSAGE,RCDPERR
  1. ;
  1. ; build error message
  1. S MESSAGE(1)="This message was received by the Automatic Payment Processing Server"
  1. S MESSAGE(2)="and was NOT processed because of the following error(s):"
  1. S MESSAGE(3)=" "
  1. S MESSAGE(4)=" "
  1. I ERROR'="" S MESSAGE(4)=" "_ERROR_"." D TRANERR^RCDPXPA1(RCDPDATE,RCDPXMZ,ERROR)
  1. ; display multiple errors
  1. S LINE=4,RCDPERR=0 F S RCDPERR=$O(^TMP($J,"RCDPXPAY","ERROR",RCDPERR)) Q:'RCDPERR D
  1. . S LINE=LINE+1,MESSAGE(LINE)=" "_^TMP($J,"RCDPXPAY","ERROR",RCDPERR)_"."
  1. . D TRANERR^RCDPXPA1(RCDPDATE,RCDPXMZ,^TMP($J,"RCDPXPAY","ERROR",RCDPERR))
  1. ;
  1. ; send message with response
  1. D MAILRESP(RCDPXMZ,.MESSAGE)
  1. ;
  1. ; set the transmissions status to error
  1. I $G(RCDPDATE) D TRANSTAT^RCDPXPA1(RCDPDATE,"e")
  1. Q
  1. ;
  1. ;
  1. DUPLCATE(RCDPDATE,SEQUENCE,RCDPXMZ) ; reply with duplicate warning message
  1. N MESSAGE,ORIGXMZ
  1. S ORIGXMZ=$P($G(^RCY(344.2,RCDPDATE,1,SEQUENCE,0)),"^",4) I 'ORIGXMZ S ORIGXMZ="unknown"
  1. ; same message sent to server twice
  1. I ORIGXMZ=RCDPXMZ Q
  1. ;
  1. S MESSAGE(1)="* * * * * W A R N I N G * * * * *"
  1. S MESSAGE(2)=" "
  1. S MESSAGE(3)="This message was received by the Automatic Payment Processing Server"
  1. S MESSAGE(4)="and is a duplicate sequence number ["_SEQUENCE_"] (line 1, piece 2)."
  1. S MESSAGE(5)=" "
  1. S MESSAGE(6)="The Automatic Payment Processing Server will only process the first"
  1. S MESSAGE(7)="message it receives for a sequence. The first message for the sequence"
  1. S MESSAGE(8)="was in mail message number "_ORIGXMZ_" and has been forwarded to you for"
  1. S MESSAGE(9)="review. Message number "_ORIGXMZ_" will be used for payment processing."
  1. S MESSAGE(10)="This message will not be used."
  1. ;
  1. I ORIGXMZ D MAILRESP(ORIGXMZ,"") ; forward original
  1. D MAILRESP(RCDPXMZ,.MESSAGE) ; send response to duplicate
  1. Q
  1. ;
  1. ;
  1. RETRAN ; ask for retransmission
  1. N %Z,COUNT,DATA,DATE,MESSAGE,RCDPDA,STATUS,X9,XCNP,XMDUZ,XMZ
  1. S MESSAGE(1)="The following Automatic Payment(s) have not been processed and need"
  1. S MESSAGE(2)="to be retransmitted to the Automatic Payment Processing Server."
  1. S MESSAGE(3)=""
  1. S MESSAGE(4)=" TranDate Deposit# DepositDate Reason"
  1. S MESSAGE(5)=" -------- -------- ----------- ------"
  1. S COUNT=5
  1. S RCDPDA=0 F S RCDPDA=$O(^TMP($J,"RCDPXPAY","RETRAN",RCDPDA)) Q:'RCDPDA D
  1. . S DATE=$E($P(RCDPDA,"^"),4,5)_"-"_$E($P(RCDPDA,"^"),6,7)_"-"_$E($P(RCDPDA,"^"),2,3)
  1. . S DATA=^TMP($J,"RCDPXPAY","RETRAN",RCDPDA)
  1. . I $P(DATA,"^")="" S $P(DATA,"^")="unknown"
  1. . I $P(DATA,"^",2)="" S $P(DATA,"^",2)="unknown"
  1. . I $P(DATA,"^",3)="" S $P(DATA,"^",3)="unknown"
  1. . S $P(DATA,"^")=$E($P(DATA,"^")_" ",1,8)
  1. . S $P(DATA,"^",2)=$E($P(DATA,"^",2)_" ",1,11)
  1. . S $P(DATA,"^",3)=$S($P(DATA,"^",3)="r":"Partial Payment Received",$P(DATA,"^",3)="p":"Partial Payment Processed",1:"Error in Payment Message")
  1. . S COUNT=COUNT+1
  1. . S MESSAGE(COUNT)=" "_DATE_" "_$P(DATA,"^")_" "_$P(DATA,"^",2)_" "_$P(DATA,"^",3)
  1. S XMTEXT="MESSAGE("
  1. S XMSUB="Request Auto Payment Retransmission"
  1. S XMDUZ="AR Package",XMY("G.RCDP PAYMENTS")=""
  1. D ^XMD
  1. Q
  1. ;
  1. ;
  1. MAILRESP(RCDPXMZ,MESSAGE) ; enter response and forward message to mail group
  1. N %H,%I,%Z,ER,X,X9,XMA,XMC0,XMQF,XMZ,XMZ2,Z
  1. ; create response
  1. I $G(MESSAGE(1))'="" S %=$$ENT^XMA2R(RCDPXMZ,"Automatic Payment Processing Server Response",.MESSAGE,"","AR Package")
  1. ; forward original message
  1. S XMDUZ="AR Package",XMY("G.RCDP PAYMENTS")=""
  1. S XMZ=RCDPXMZ
  1. D ENT1^XMD
  1. Q
  1. ;
  1. ;
  1. PROCMSG ; show the message with processed deposits and receipts
  1. N %Z,MESSAGE,RCCOUNT,RCDPDATA,RCRECTDA,RCERROR,RCFLAG,RCUNLINK,X9,XCNP,XMDUZ,XMZ
  1. S MESSAGE(1)="The following Automatic Payment(s) have been processed by the"
  1. S MESSAGE(2)="Automatic Payment Processing Server."
  1. S MESSAGE(4)=" Deposit# Receipt# FMS Document# Total Amount Unlinked Accts"
  1. S MESSAGE(5)=" -------- ---------- ------------- ------------ --------------"
  1. S RCCOUNT=5
  1. I '$O(^TMP($J,"RCDPXPAP","PROCESS",0)) S MESSAGE(6)=" <<none>>",RCCOUNT=6
  1. S RCRECTDA=0 F S RCRECTDA=$O(^TMP($J,"RCDPXPAP","PROCESS",RCRECTDA)) Q:'RCRECTDA D
  1. . D DIQ344^RCDPRPLM(RCRECTDA,".01;.06;.15;200;")
  1. . S RCUNLINK=+^TMP($J,"RCDPXPAP","PROCESS",RCRECTDA)
  1. . S RCCOUNT=RCCOUNT+1
  1. . S MESSAGE(RCCOUNT)=$J($G(RCDPDATA(344,RCRECTDA,.06,"E")),10)
  1. . S MESSAGE(RCCOUNT)=MESSAGE(RCCOUNT)_$J($G(RCDPDATA(344,RCRECTDA,.01,"E")),12)
  1. . S MESSAGE(RCCOUNT)=MESSAGE(RCCOUNT)_$J($G(RCDPDATA(344,RCRECTDA,200,"E")),16)
  1. . S MESSAGE(RCCOUNT)=MESSAGE(RCCOUNT)_$J($G(RCDPDATA(344,RCRECTDA,.15,"E")),14,2)
  1. . S MESSAGE(RCCOUNT)=MESSAGE(RCCOUNT)_$J(+RCUNLINK,16)
  1. . ; set error flag if receipt did not process (no fms document)
  1. . I $G(RCDPDATA(344,RCRECTDA,200,"E"))="" S RCERROR=1
  1. ;
  1. ; show if any receipts need to manually be processed due to errors
  1. I $G(RCERROR) D
  1. . S RCCOUNT=RCCOUNT+1,MESSAGE(RCCOUNT)=" "
  1. . S RCCOUNT=RCCOUNT+1,MESSAGE(RCCOUNT)="Warning: The receipts listed above that are missing the FMS Document# did not"
  1. . S RCCOUNT=RCCOUNT+1,MESSAGE(RCCOUNT)="completely process due to an error. Use the Receipt Processing option to view"
  1. . S RCCOUNT=RCCOUNT+1,MESSAGE(RCCOUNT)="the error and reprocess the receipt."
  1. . S RCCOUNT=RCCOUNT+1,MESSAGE(RCCOUNT)=" "
  1. ;
  1. ; show duplicate receipts, previously received/processed
  1. I $O(^TMP($J,"RCDPXPAP","DUPLICATE",0)) D
  1. . S RCCOUNT=RCCOUNT+1,MESSAGE(RCCOUNT)=" "
  1. . S RCCOUNT=RCCOUNT+1,MESSAGE(RCCOUNT)="The following receipts were received as duplicates."
  1. . S RCCOUNT=RCCOUNT+1,MESSAGE(RCCOUNT)=" Deposit# Receipt# FMS Document# Total Amount"
  1. . S RCCOUNT=RCCOUNT+1,MESSAGE(RCCOUNT)=" -------- ---------- ------------- ------------"
  1. . S RCRECTDA=0 F S RCRECTDA=$O(^TMP($J,"RCDPXPAP","DUPLICATE",RCRECTDA)) Q:'RCRECTDA D
  1. . . D DIQ344^RCDPRPLM(RCRECTDA,".01;.06;.15;200;")
  1. . . S RCCOUNT=RCCOUNT+1
  1. . . S MESSAGE(RCCOUNT)=$J($G(RCDPDATA(344,RCRECTDA,.06,"E")),10)
  1. . . S MESSAGE(RCCOUNT)=MESSAGE(RCCOUNT)_$J($G(RCDPDATA(344,RCRECTDA,.01,"E")),12)
  1. . . S MESSAGE(RCCOUNT)=MESSAGE(RCCOUNT)_$J($G(RCDPDATA(344,RCRECTDA,200,"E")),16)
  1. . . ; show ** if fms document processed
  1. . . I $P(^TMP($J,"RCDPXPAP","DUPLICATE",RCRECTDA),"^",2)=1 S MESSAGE(RCCOUNT)=MESSAGE(RCCOUNT)_"**",RCFLAG=1
  1. . . E S MESSAGE(RCCOUNT)=MESSAGE(RCCOUNT)_" "
  1. . . S MESSAGE(RCCOUNT)=MESSAGE(RCCOUNT)_$J($G(RCDPDATA(344,RCRECTDA,.15,"E")),12,2)
  1. . . S MESSAGE(RCCOUNT)=MESSAGE(RCCOUNT)_" "_$P(^TMP($J,"RCDPXPAP","DUPLICATE",RCRECTDA),"^")
  1. ;
  1. I $G(RCFLAG) S RCCOUNT=RCCOUNT+1,MESSAGE(RCCOUNT)=" ** FMS Document Processed"
  1. S XMTEXT="MESSAGE("
  1. S XMSUB="Auto Payment Processing Completed"
  1. S XMDUZ="AR Package",XMY("G.RCDP PAYMENTS")=""
  1. D ^XMD
  1. Q
  1. ;
  1. ;
  1. ZEROMSG(DATE) ; show RT received with no payments for a date
  1. ; date in the form MMDDYYYY
  1. S DATE=$E(DATE,1,2)_"/"_$E(DATE,3,4)_"/"_$E(DATE,5,8)
  1. N %Z,MESSAGE,X9,XCNP,XMDUZ,XMZ
  1. S MESSAGE(1)="The Automatic Payment Processing Server received a Lockbox"
  1. S MESSAGE(2)="transmission for "_DATE_" with no payments to process."
  1. S XMTEXT="MESSAGE("
  1. S XMSUB="Auto Payment Processing Completed"
  1. S XMDUZ="AR Package",XMY("G.RCDP PAYMENTS")=""
  1. D ^XMD
  1. Q