| 1 | RCDPXPAM ;WISC/RFJ-auto process payments, message generation ;1 Jun 99
 | 
|---|
| 2 |  ;;4.5;Accounts Receivable;**114,153**;Mar 20, 1995
 | 
|---|
| 3 |  ;;Per VHA Directive 10-93-142, this routine should not be modified.
 | 
|---|
| 4 |  Q
 | 
|---|
| 5 |  ;
 | 
|---|
| 6 |  ;
 | 
|---|
| 7 | ERROR(RCDPDATE,RCDPXMZ,ERROR) ;  reply to server message with error
 | 
|---|
| 8 |  ;  pass ^tmp($j,"rcdpxpay","error",#) for additional/multiple errors
 | 
|---|
| 9 |  N LINE,MESSAGE,RCDPERR
 | 
|---|
| 10 |  ;
 | 
|---|
| 11 |  ;  build error message
 | 
|---|
| 12 |  S MESSAGE(1)="This message was received by the Automatic Payment Processing Server"
 | 
|---|
| 13 |  S MESSAGE(2)="and was NOT processed because of the following error(s):"
 | 
|---|
| 14 |  S MESSAGE(3)=" "
 | 
|---|
| 15 |  S MESSAGE(4)=" "
 | 
|---|
| 16 |  I ERROR'="" S MESSAGE(4)="  "_ERROR_"." D TRANERR^RCDPXPA1(RCDPDATE,RCDPXMZ,ERROR)
 | 
|---|
| 17 |  ;  display multiple errors
 | 
|---|
| 18 |  S LINE=4,RCDPERR=0 F  S RCDPERR=$O(^TMP($J,"RCDPXPAY","ERROR",RCDPERR)) Q:'RCDPERR  D
 | 
|---|
| 19 |  .   S LINE=LINE+1,MESSAGE(LINE)="  "_^TMP($J,"RCDPXPAY","ERROR",RCDPERR)_"."
 | 
|---|
| 20 |  .   D TRANERR^RCDPXPA1(RCDPDATE,RCDPXMZ,^TMP($J,"RCDPXPAY","ERROR",RCDPERR))
 | 
|---|
| 21 |  ;
 | 
|---|
| 22 |  ;  send message with response
 | 
|---|
| 23 |  D MAILRESP(RCDPXMZ,.MESSAGE)
 | 
|---|
| 24 |  ;
 | 
|---|
| 25 |  ;  set the transmissions status to error
 | 
|---|
| 26 |  I $G(RCDPDATE) D TRANSTAT^RCDPXPA1(RCDPDATE,"e")
 | 
|---|
| 27 |  Q
 | 
|---|
| 28 |  ;
 | 
|---|
| 29 |  ;
 | 
|---|
| 30 | DUPLCATE(RCDPDATE,SEQUENCE,RCDPXMZ) ;  reply with duplicate warning message
 | 
|---|
| 31 |  N MESSAGE,ORIGXMZ
 | 
|---|
| 32 |  S ORIGXMZ=$P($G(^RCY(344.2,RCDPDATE,1,SEQUENCE,0)),"^",4) I 'ORIGXMZ S ORIGXMZ="unknown"
 | 
|---|
| 33 |  ;  same message sent to server twice
 | 
|---|
| 34 |  I ORIGXMZ=RCDPXMZ Q
 | 
|---|
| 35 |  ;
 | 
|---|
| 36 |  S MESSAGE(1)="* * * * *  W A R N I N G  * * * * *"
 | 
|---|
| 37 |  S MESSAGE(2)=" "
 | 
|---|
| 38 |  S MESSAGE(3)="This message was received by the Automatic Payment Processing Server"
 | 
|---|
| 39 |  S MESSAGE(4)="and is a duplicate sequence number ["_SEQUENCE_"] (line 1, piece 2)."
 | 
|---|
| 40 |  S MESSAGE(5)=" "
 | 
|---|
| 41 |  S MESSAGE(6)="The Automatic Payment Processing Server will only process the first"
 | 
|---|
| 42 |  S MESSAGE(7)="message it receives for a sequence.  The first message for the sequence"
 | 
|---|
| 43 |  S MESSAGE(8)="was in mail message number "_ORIGXMZ_" and has been forwarded to you for"
 | 
|---|
| 44 |  S MESSAGE(9)="review.  Message number "_ORIGXMZ_" will be used for payment processing."
 | 
|---|
| 45 |  S MESSAGE(10)="This message will not be used."
 | 
|---|
| 46 |  ;
 | 
|---|
| 47 |  I ORIGXMZ D MAILRESP(ORIGXMZ,"") ;  forward original
 | 
|---|
| 48 |  D MAILRESP(RCDPXMZ,.MESSAGE)     ;  send response to duplicate
 | 
|---|
| 49 |  Q
 | 
|---|
| 50 |  ;
 | 
|---|
| 51 |  ;
 | 
|---|
| 52 | RETRAN ;  ask for retransmission
 | 
|---|
| 53 |  N %Z,COUNT,DATA,DATE,MESSAGE,RCDPDA,STATUS,X9,XCNP,XMDUZ,XMZ
 | 
|---|
| 54 |  S MESSAGE(1)="The following Automatic Payment(s) have not been processed and need"
 | 
|---|
| 55 |  S MESSAGE(2)="to be retransmitted to the Automatic Payment Processing Server."
 | 
|---|
| 56 |  S MESSAGE(3)=""
 | 
|---|
| 57 |  S MESSAGE(4)="  TranDate    Deposit#    DepositDate    Reason"
 | 
|---|
| 58 |  S MESSAGE(5)="  --------    --------    -----------    ------"
 | 
|---|
| 59 |  S COUNT=5
 | 
|---|
| 60 |  S RCDPDA=0 F  S RCDPDA=$O(^TMP($J,"RCDPXPAY","RETRAN",RCDPDA)) Q:'RCDPDA  D
 | 
|---|
| 61 |  .   S DATE=$E($P(RCDPDA,"^"),4,5)_"-"_$E($P(RCDPDA,"^"),6,7)_"-"_$E($P(RCDPDA,"^"),2,3)
 | 
|---|
| 62 |  .   S DATA=^TMP($J,"RCDPXPAY","RETRAN",RCDPDA)
 | 
|---|
| 63 |  .   I $P(DATA,"^")="" S $P(DATA,"^")="unknown"
 | 
|---|
| 64 |  .   I $P(DATA,"^",2)="" S $P(DATA,"^",2)="unknown"
 | 
|---|
| 65 |  .   I $P(DATA,"^",3)="" S $P(DATA,"^",3)="unknown"
 | 
|---|
| 66 |  .   S $P(DATA,"^")=$E($P(DATA,"^")_"        ",1,8)
 | 
|---|
| 67 |  .   S $P(DATA,"^",2)=$E($P(DATA,"^",2)_"           ",1,11)
 | 
|---|
| 68 |  .   S $P(DATA,"^",3)=$S($P(DATA,"^",3)="r":"Partial Payment Received",$P(DATA,"^",3)="p":"Partial Payment Processed",1:"Error in Payment Message")
 | 
|---|
| 69 |  .   S COUNT=COUNT+1
 | 
|---|
| 70 |  .   S MESSAGE(COUNT)="  "_DATE_"    "_$P(DATA,"^")_"    "_$P(DATA,"^",2)_"    "_$P(DATA,"^",3)
 | 
|---|
| 71 |  S XMTEXT="MESSAGE("
 | 
|---|
| 72 |  S XMSUB="Request Auto Payment Retransmission"
 | 
|---|
| 73 |  S XMDUZ="AR Package",XMY("G.RCDP PAYMENTS")=""
 | 
|---|
| 74 |  D ^XMD
 | 
|---|
| 75 |  Q
 | 
|---|
| 76 |  ;
 | 
|---|
| 77 |  ;
 | 
|---|
| 78 | MAILRESP(RCDPXMZ,MESSAGE) ;  enter response and forward message to mail group
 | 
|---|
| 79 |  N %H,%I,%Z,ER,X,X9,XMA,XMC0,XMQF,XMZ,XMZ2,Z
 | 
|---|
| 80 |  ;  create response
 | 
|---|
| 81 |  I $G(MESSAGE(1))'="" S %=$$ENT^XMA2R(RCDPXMZ,"Automatic Payment Processing Server Response",.MESSAGE,"","AR Package")
 | 
|---|
| 82 |  ;  forward original message
 | 
|---|
| 83 |  S XMDUZ="AR Package",XMY("G.RCDP PAYMENTS")=""
 | 
|---|
| 84 |  S XMZ=RCDPXMZ
 | 
|---|
| 85 |  D ENT1^XMD
 | 
|---|
| 86 |  Q
 | 
|---|
| 87 |  ;
 | 
|---|
| 88 |  ;
 | 
|---|
| 89 | PROCMSG ;  show the message with processed deposits and receipts
 | 
|---|
| 90 |  N %Z,MESSAGE,RCCOUNT,RCDPDATA,RCRECTDA,RCERROR,RCFLAG,RCUNLINK,X9,XCNP,XMDUZ,XMZ
 | 
|---|
| 91 |  S MESSAGE(1)="The following Automatic Payment(s) have been processed by the"
 | 
|---|
| 92 |  S MESSAGE(2)="Automatic Payment Processing Server."
 | 
|---|
| 93 |  S MESSAGE(4)="  Deposit#    Receipt#  FMS Document#   Total Amount  Unlinked Accts"
 | 
|---|
| 94 |  S MESSAGE(5)="  --------  ----------  -------------   ------------  --------------"
 | 
|---|
| 95 |  S RCCOUNT=5
 | 
|---|
| 96 |  I '$O(^TMP($J,"RCDPXPAP","PROCESS",0)) S MESSAGE(6)="  <<none>>",RCCOUNT=6
 | 
|---|
| 97 |  S RCRECTDA=0 F  S RCRECTDA=$O(^TMP($J,"RCDPXPAP","PROCESS",RCRECTDA)) Q:'RCRECTDA  D
 | 
|---|
| 98 |  .   D DIQ344^RCDPRPLM(RCRECTDA,".01;.06;.15;200;")
 | 
|---|
| 99 |  .   S RCUNLINK=+^TMP($J,"RCDPXPAP","PROCESS",RCRECTDA)
 | 
|---|
| 100 |  .   S RCCOUNT=RCCOUNT+1
 | 
|---|
| 101 |  .   S MESSAGE(RCCOUNT)=$J($G(RCDPDATA(344,RCRECTDA,.06,"E")),10)
 | 
|---|
| 102 |  .   S MESSAGE(RCCOUNT)=MESSAGE(RCCOUNT)_$J($G(RCDPDATA(344,RCRECTDA,.01,"E")),12)
 | 
|---|
| 103 |  .   S MESSAGE(RCCOUNT)=MESSAGE(RCCOUNT)_$J($G(RCDPDATA(344,RCRECTDA,200,"E")),16)
 | 
|---|
| 104 |  .   S MESSAGE(RCCOUNT)=MESSAGE(RCCOUNT)_$J($G(RCDPDATA(344,RCRECTDA,.15,"E")),14,2)
 | 
|---|
| 105 |  .   S MESSAGE(RCCOUNT)=MESSAGE(RCCOUNT)_$J(+RCUNLINK,16)
 | 
|---|
| 106 |  .   ;  set error flag if receipt did not process (no fms document)
 | 
|---|
| 107 |  .   I $G(RCDPDATA(344,RCRECTDA,200,"E"))="" S RCERROR=1
 | 
|---|
| 108 |  ;
 | 
|---|
| 109 |  ;  show if any receipts need to manually be processed due to errors
 | 
|---|
| 110 |  I $G(RCERROR) D
 | 
|---|
| 111 |  .   S RCCOUNT=RCCOUNT+1,MESSAGE(RCCOUNT)=" "
 | 
|---|
| 112 |  .   S RCCOUNT=RCCOUNT+1,MESSAGE(RCCOUNT)="Warning: The receipts listed above that are missing the FMS Document# did not"
 | 
|---|
| 113 |  .   S RCCOUNT=RCCOUNT+1,MESSAGE(RCCOUNT)="completely process due to an error.  Use the Receipt Processing option to view"
 | 
|---|
| 114 |  .   S RCCOUNT=RCCOUNT+1,MESSAGE(RCCOUNT)="the error and reprocess the receipt."
 | 
|---|
| 115 |  .   S RCCOUNT=RCCOUNT+1,MESSAGE(RCCOUNT)=" "
 | 
|---|
| 116 |  ;
 | 
|---|
| 117 |  ;  show duplicate receipts, previously received/processed
 | 
|---|
| 118 |  I $O(^TMP($J,"RCDPXPAP","DUPLICATE",0)) D
 | 
|---|
| 119 |  .   S RCCOUNT=RCCOUNT+1,MESSAGE(RCCOUNT)=" "
 | 
|---|
| 120 |  .   S RCCOUNT=RCCOUNT+1,MESSAGE(RCCOUNT)="The following receipts were received as duplicates."
 | 
|---|
| 121 |  .   S RCCOUNT=RCCOUNT+1,MESSAGE(RCCOUNT)="  Deposit#    Receipt#  FMS Document#   Total Amount"
 | 
|---|
| 122 |  .   S RCCOUNT=RCCOUNT+1,MESSAGE(RCCOUNT)="  --------  ----------  -------------   ------------"
 | 
|---|
| 123 |  .   S RCRECTDA=0 F  S RCRECTDA=$O(^TMP($J,"RCDPXPAP","DUPLICATE",RCRECTDA)) Q:'RCRECTDA  D
 | 
|---|
| 124 |  .   .   D DIQ344^RCDPRPLM(RCRECTDA,".01;.06;.15;200;")
 | 
|---|
| 125 |  .   .   S RCCOUNT=RCCOUNT+1
 | 
|---|
| 126 |  .   .   S MESSAGE(RCCOUNT)=$J($G(RCDPDATA(344,RCRECTDA,.06,"E")),10)
 | 
|---|
| 127 |  .   .   S MESSAGE(RCCOUNT)=MESSAGE(RCCOUNT)_$J($G(RCDPDATA(344,RCRECTDA,.01,"E")),12)
 | 
|---|
| 128 |  .   .   S MESSAGE(RCCOUNT)=MESSAGE(RCCOUNT)_$J($G(RCDPDATA(344,RCRECTDA,200,"E")),16)
 | 
|---|
| 129 |  .   .   ;  show ** if fms document processed
 | 
|---|
| 130 |  .   .   I $P(^TMP($J,"RCDPXPAP","DUPLICATE",RCRECTDA),"^",2)=1 S MESSAGE(RCCOUNT)=MESSAGE(RCCOUNT)_"**",RCFLAG=1
 | 
|---|
| 131 |  .   .   E  S MESSAGE(RCCOUNT)=MESSAGE(RCCOUNT)_"  "
 | 
|---|
| 132 |  .   .   S MESSAGE(RCCOUNT)=MESSAGE(RCCOUNT)_$J($G(RCDPDATA(344,RCRECTDA,.15,"E")),12,2)
 | 
|---|
| 133 |  .   .   S MESSAGE(RCCOUNT)=MESSAGE(RCCOUNT)_"  "_$P(^TMP($J,"RCDPXPAP","DUPLICATE",RCRECTDA),"^")
 | 
|---|
| 134 |  ;
 | 
|---|
| 135 |  I $G(RCFLAG) S RCCOUNT=RCCOUNT+1,MESSAGE(RCCOUNT)="                                      ** FMS Document Processed"
 | 
|---|
| 136 |  S XMTEXT="MESSAGE("
 | 
|---|
| 137 |  S XMSUB="Auto Payment Processing Completed"
 | 
|---|
| 138 |  S XMDUZ="AR Package",XMY("G.RCDP PAYMENTS")=""
 | 
|---|
| 139 |  D ^XMD
 | 
|---|
| 140 |  Q
 | 
|---|
| 141 |  ;
 | 
|---|
| 142 |  ;
 | 
|---|
| 143 | ZEROMSG(DATE) ;  show RT received with no payments for a date
 | 
|---|
| 144 |  ;  date in the form MMDDYYYY
 | 
|---|
| 145 |  S DATE=$E(DATE,1,2)_"/"_$E(DATE,3,4)_"/"_$E(DATE,5,8)
 | 
|---|
| 146 |  N %Z,MESSAGE,X9,XCNP,XMDUZ,XMZ
 | 
|---|
| 147 |  S MESSAGE(1)="The Automatic Payment Processing Server received a Lockbox"
 | 
|---|
| 148 |  S MESSAGE(2)="transmission for "_DATE_" with no payments to process."
 | 
|---|
| 149 |  S XMTEXT="MESSAGE("
 | 
|---|
| 150 |  S XMSUB="Auto Payment Processing Completed"
 | 
|---|
| 151 |  S XMDUZ="AR Package",XMY("G.RCDP PAYMENTS")=""
 | 
|---|
| 152 |  D ^XMD
 | 
|---|
| 153 |  Q
 | 
|---|