| 1 | IBCEMCA ;ALB/ESG - Multiple CSA Message Management ;20-SEP-2005
 | 
|---|
| 2 |  ;;2.0;INTEGRATED BILLING;**320**;21-MAR-1994
 | 
|---|
| 3 |  ;;Per VHA Directive 10-93-142, this routine should not be modified.
 | 
|---|
| 4 |  ;
 | 
|---|
| 5 |  Q
 | 
|---|
| 6 |  ;
 | 
|---|
| 7 | SCREEN ; Change the message selection criteria
 | 
|---|
| 8 |  NEW DIC,DIR,DIROUT,DIRUT,DTOUT,DUOUT,EDI,IBDONE,IBPAYER,INST,PROF,RESET,X,Y
 | 
|---|
| 9 |  S VALMBCK="R",RESET=0
 | 
|---|
| 10 |  D FULL^VALM1
 | 
|---|
| 11 |  W !
 | 
|---|
| 12 |  S DIR(0)="Y",DIR("A")="Do you want to change the MCS selection criteria"
 | 
|---|
| 13 |  S DIR("B")="Yes" D ^DIR K DIR
 | 
|---|
| 14 |  I 'Y G SCREENX          ; get out; no list rebuild
 | 
|---|
| 15 |  K ^TMP($J,"IBCEMCA")    ; kill selection area and rebuild below
 | 
|---|
| 16 |  K VALMHDR               ; recalculate totals in header area
 | 
|---|
| 17 |  S VALMBG=1              ; begin new list display at line 1
 | 
|---|
| 18 |  ;
 | 
|---|
| 19 | Q1 ; payer
 | 
|---|
| 20 |  W !!,"PAYER SELECTION:"
 | 
|---|
| 21 |  S IBPAYER=""
 | 
|---|
| 22 |  S DIR(0)="SA^A:All Payers;S:Selected Payers"
 | 
|---|
| 23 |  S DIR("A")="Include All Payers or Selected Payers? "
 | 
|---|
| 24 |  S DIR("B")="All"
 | 
|---|
| 25 |  D ^DIR K DIR
 | 
|---|
| 26 |  I $D(DIROUT)!$D(DIRUT) S RESET=1 G QX  ; kill scratch and rebuild list
 | 
|---|
| 27 |  I Y="A" K ^TMP($J,"IBCEMCA","INS") G Q2
 | 
|---|
| 28 |  W !
 | 
|---|
| 29 |  S DIR(0)="Y"
 | 
|---|
| 30 |  S DIR("A")="   Include all payers with the same electronic Payer ID"
 | 
|---|
| 31 |  S DIR("B")="Yes"
 | 
|---|
| 32 |  D ^DIR K DIR
 | 
|---|
| 33 |  I $D(DIROUT) S RESET=1 G QX   ; kill scratch and rebuild the list
 | 
|---|
| 34 |  I $D(DIRUT) G Q1
 | 
|---|
| 35 |  S IBPAYER=Y
 | 
|---|
| 36 |  W !
 | 
|---|
| 37 |  ;
 | 
|---|
| 38 |  S IBDONE=0
 | 
|---|
| 39 |  F  D  Q:IBDONE
 | 
|---|
| 40 |  . S DIC=36,DIC(0)="AEMQ",DIC("A")="   Select Insurance Company: "
 | 
|---|
| 41 |  . I $O(^TMP($J,"IBCEMCA","INS",1,"")) S DIC("A")="   Select Another Insurance Company: "
 | 
|---|
| 42 |  . S DIC("W")="D INSLIST^IBCEMCA(Y)"
 | 
|---|
| 43 |  . D ^DIC K DIC                ; lookup
 | 
|---|
| 44 |  . I X="^^" S IBDONE=2 Q       ; user entered ^^
 | 
|---|
| 45 |  . I +Y'>0 S IBDONE=1 Q        ; user is done
 | 
|---|
| 46 |  . S ^TMP($J,"IBCEMCA","INS",1,+Y)=$P(Y,U,2)
 | 
|---|
| 47 |  . I 'IBPAYER Q
 | 
|---|
| 48 |  . S EDI=$$UP^XLFSTR($G(^DIC(36,+Y,3)))
 | 
|---|
| 49 |  . S PROF=$P(EDI,U,2)
 | 
|---|
| 50 |  . S INST=$P(EDI,U,4)
 | 
|---|
| 51 |  . I PROF'="",PROF'["PRNT" S ^TMP($J,"IBCEMCA","INS",2,PROF,+Y)=""
 | 
|---|
| 52 |  . I INST'="",INST'["PRNT" S ^TMP($J,"IBCEMCA","INS",2,INST,+Y)=""
 | 
|---|
| 53 |  . Q
 | 
|---|
| 54 |  ;
 | 
|---|
| 55 |  I IBDONE=2 S RESET=1 G QX      ;kill scratch and rebuild the list
 | 
|---|
| 56 |  ;
 | 
|---|
| 57 |  I '$O(^TMP($J,"IBCEMCA","INS",1,"")) D  G Q1
 | 
|---|
| 58 |  . W *7,!!?3,"No payers have been selected.  Please try again."
 | 
|---|
| 59 |  . Q
 | 
|---|
| 60 |  ;
 | 
|---|
| 61 | Q2 ; division
 | 
|---|
| 62 |  W !!,"DIVISION SELECTION:"
 | 
|---|
| 63 |  S DIR(0)="SA^A:All Divisions;S:Selected Divisions"
 | 
|---|
| 64 |  S DIR("A")="Include All Divisions or Selected Divisions? "
 | 
|---|
| 65 |  S DIR("B")="All"
 | 
|---|
| 66 |  D ^DIR K DIR
 | 
|---|
| 67 |  I $D(DIROUT) S RESET=1 G QX  ; kill scratch and rebuild list
 | 
|---|
| 68 |  I $D(DIRUT) G Q1
 | 
|---|
| 69 |  I Y="A" K ^TMP($J,"IBCEMCA","DIV") G Q3
 | 
|---|
| 70 |  ;
 | 
|---|
| 71 |  W !
 | 
|---|
| 72 |  S IBDONE=0
 | 
|---|
| 73 |  F  D  Q:IBDONE
 | 
|---|
| 74 |  . S DIC=40.8,DIC(0)="AEMQ",DIC("A")="   Select Division: "
 | 
|---|
| 75 |  . I $O(^TMP($J,"IBCEMCA","DIV","")) S DIC("A")="   Select Another Division: "
 | 
|---|
| 76 |  . D ^DIC K DIC                ; lookup
 | 
|---|
| 77 |  . I X="^^" S IBDONE=2 Q       ; user entered ^^
 | 
|---|
| 78 |  . I +Y'>0 S IBDONE=1 Q        ; user is done
 | 
|---|
| 79 |  . S ^TMP($J,"IBCEMCA","DIV",+Y)=$P(Y,U,2)
 | 
|---|
| 80 |  . Q
 | 
|---|
| 81 |  ;
 | 
|---|
| 82 |  I IBDONE=2 S RESET=1 G QX      ;kill scratch and rebuild the list
 | 
|---|
| 83 |  ;
 | 
|---|
| 84 |  I '$O(^TMP($J,"IBCEMCA","DIV","")) D  G Q2
 | 
|---|
| 85 |  . W *7,!!?3,"No divisions have been selected.  Please try again."
 | 
|---|
| 86 |  . Q
 | 
|---|
| 87 |  ;
 | 
|---|
| 88 | Q3 ; message text
 | 
|---|
| 89 |  W !!,"ERROR MESSAGE TEXT SELECTION:"
 | 
|---|
| 90 |  S DIR(0)="SA^A:All Error Message Text;S:Select Error Message Text"
 | 
|---|
| 91 |  S DIR("A")="Include All Error Message Text or Select Error Message Text? "
 | 
|---|
| 92 |  S DIR("B")="All"
 | 
|---|
| 93 |  D ^DIR K DIR
 | 
|---|
| 94 |  I $D(DIROUT) S RESET=1 G QX  ; kill scratch and rebuild list
 | 
|---|
| 95 |  I $D(DIRUT) G Q2
 | 
|---|
| 96 |  I Y="A" K ^TMP($J,"IBCEMCA","TEXT") G Q4
 | 
|---|
| 97 |  ;
 | 
|---|
| 98 |  W !
 | 
|---|
| 99 |  S IBDONE=0
 | 
|---|
| 100 |  F  D  Q:IBDONE
 | 
|---|
| 101 |  . S DIR(0)="FAOU"
 | 
|---|
| 102 |  . S DIR("A")="   Text String: "
 | 
|---|
| 103 |  . I $O(^TMP($J,"IBCEMCA","TEXT",""))'="" S DIR("A")="   Another Text String: "
 | 
|---|
| 104 |  . D ^DIR K DIR                ; user response
 | 
|---|
| 105 |  . I $D(DIROUT) S IBDONE=2 Q   ; user entered ^^
 | 
|---|
| 106 |  . I $D(DIRUT) S IBDONE=1 Q    ; leading up-arrow or time-out
 | 
|---|
| 107 |  . I Y="" S IBDONE=1 Q         ; null response
 | 
|---|
| 108 |  . S ^TMP($J,"IBCEMCA","TEXT",Y)=""
 | 
|---|
| 109 |  . Q
 | 
|---|
| 110 |  ;
 | 
|---|
| 111 |  I IBDONE=2 S RESET=1 G QX      ;kill scratch and rebuild the list
 | 
|---|
| 112 |  ;
 | 
|---|
| 113 |  I $O(^TMP($J,"IBCEMCA","TEXT",""))="" D  G Q3
 | 
|---|
| 114 |  . W *7,!!?3,"No text has been selected.  Please try again."
 | 
|---|
| 115 |  . Q
 | 
|---|
| 116 |  ;
 | 
|---|
| 117 | Q4 ; date range for when message received
 | 
|---|
| 118 |  W !!,"DATE MESSAGE RECEIVED SELECTION:"
 | 
|---|
| 119 |  S DIR(0)="SA^A:All Dates;S:Select Date Range"
 | 
|---|
| 120 |  S DIR("A")="Include All Dates or Select a Date Range? "
 | 
|---|
| 121 |  S DIR("B")="All"
 | 
|---|
| 122 |  D ^DIR K DIR
 | 
|---|
| 123 |  I $D(DIROUT) S RESET=1 G QX  ; kill scratch and rebuild list
 | 
|---|
| 124 |  I $D(DIRUT) G Q3
 | 
|---|
| 125 |  I Y="A" K ^TMP($J,"IBCEMCA","DATE") G QX
 | 
|---|
| 126 |  ;
 | 
|---|
| 127 | Q4A ; beginning date
 | 
|---|
| 128 |  W !
 | 
|---|
| 129 |  S DIR(0)="DAO^:"_DT_":AEX",DIR("A")="   Enter the beginning date: "
 | 
|---|
| 130 |  D ^DIR K DIR
 | 
|---|
| 131 |  I $D(DIROUT) S RESET=1 G QX   ; kill scratch and rebuild list
 | 
|---|
| 132 |  I $D(DIRUT)!'Y G Q4
 | 
|---|
| 133 |  S $P(^TMP($J,"IBCEMCA","DATE"),U,1)=Y
 | 
|---|
| 134 |  ;
 | 
|---|
| 135 | Q4B ; ending date
 | 
|---|
| 136 |  W !
 | 
|---|
| 137 |  S DIR(0)="DAO^"_Y_":"_DT_":AEX",DIR("A")="   Enter the ending date: "
 | 
|---|
| 138 |  D ^DIR K DIR
 | 
|---|
| 139 |  I $D(DIROUT) S RESET=1 G QX   ; kill scratch and rebuild list
 | 
|---|
| 140 |  I $D(DIRUT)!'Y G Q4A
 | 
|---|
| 141 |  S $P(^TMP($J,"IBCEMCA","DATE"),U,2)=Y
 | 
|---|
| 142 |  ;
 | 
|---|
| 143 | QX ; end of questions, rebuild the list with user supplied selections
 | 
|---|
| 144 |  I RESET KILL ^TMP($J,"IBCEMCA")
 | 
|---|
| 145 |  D INIT^IBCEMCL
 | 
|---|
| 146 |  ;
 | 
|---|
| 147 | SCREENX ;
 | 
|---|
| 148 |  Q
 | 
|---|
| 149 |  ;
 | 
|---|
| 150 | TOGGLE ; Select/De-select entries in the list
 | 
|---|
| 151 |  NEW IBSEL,DIR,X,Y,DIRUT,DIROUT,DTOUT,DUOUT,IBCEMLST,IBCEMSUB,IBCEMPCE,IBZ,IBIFN,IBDA,IBVALM,Z,RSTA
 | 
|---|
| 152 |  D FULL^VALM1
 | 
|---|
| 153 |  I '$D(^TMP($J,"IBCEMCL",3)) D  G TOGGLEX
 | 
|---|
| 154 |  . W !!?5,"There are no messages to select." D PAUSE^VALM1
 | 
|---|
| 155 |  . Q
 | 
|---|
| 156 |  S DIR(0)="LO^1:"_+$O(^TMP($J,"IBCEMCL",3,""),-1)
 | 
|---|
| 157 |  S DIR("A")="Select EDI Status Messages"
 | 
|---|
| 158 |  W ! D ^DIR K DIR
 | 
|---|
| 159 |  I $D(DIRUT) G TOGGLEX
 | 
|---|
| 160 |  M IBCEMLST=Y
 | 
|---|
| 161 |  F IBCEMSUB=0:1 Q:'$D(IBCEMLST(IBCEMSUB))  F IBCEMPCE=1:1 S IBSEL=$P(IBCEMLST(IBCEMSUB),",",IBCEMPCE) Q:'IBSEL  D
 | 
|---|
| 162 |  . S IBZ=$G(^TMP($J,"IBCEMCL",3,IBSEL))
 | 
|---|
| 163 |  . S IBIFN=+IBZ,IBDA=+$P(IBZ,U,2),IBVALM=+$P(IBZ,U,4)
 | 
|---|
| 164 |  . I 'IBIFN Q
 | 
|---|
| 165 |  . I 'IBDA Q
 | 
|---|
| 166 |  . I 'IBVALM Q
 | 
|---|
| 167 |  . I '$D(^TMP($J,"IBCEMCL",2,IBVALM,0)) Q
 | 
|---|
| 168 |  . D MARK^IBCEMCL(IBDA,IBIFN,IBVALM,IBSEL,.Z)
 | 
|---|
| 169 |  . I Z'="" S RSTA(Z)=$G(RSTA(Z))+1
 | 
|---|
| 170 |  . Q
 | 
|---|
| 171 |  ;
 | 
|---|
| 172 |  I $G(RSTA("L")) D   ; display results only if some could not be selected
 | 
|---|
| 173 |  . W !!?8,"Number of messages selected:  ",+$G(RSTA("S"))
 | 
|---|
| 174 |  . W !?5,"Number of messages de-selected:  ",+$G(RSTA("D"))
 | 
|---|
| 175 |  . W !?2,"Number of messages that could not"
 | 
|---|
| 176 |  . W !?4,"be selected because other users"
 | 
|---|
| 177 |  . W !?12,"have them locked in CSA:  ",+$G(RSTA("L"))
 | 
|---|
| 178 |  . D PAUSE^VALM1
 | 
|---|
| 179 |  . Q
 | 
|---|
| 180 | TOGGLEX ;
 | 
|---|
| 181 |  S VALMBCK="R"
 | 
|---|
| 182 |  Q
 | 
|---|
| 183 |  ;
 | 
|---|
| 184 | INSLIST(INS) ; lister for DIC call.  INS is ien to file 36.
 | 
|---|
| 185 |  NEW AD,L1,CITY,ST,EDI,PROF,INST,PYRID
 | 
|---|
| 186 |  S AD=$G(^DIC(36,INS,.11))
 | 
|---|
| 187 |  S L1=$P(AD,U,1),CITY=$P(AD,U,4),ST=$P(AD,U,5)
 | 
|---|
| 188 |  I ST S ST=$P($G(^DIC(5,ST,0)),U,2)
 | 
|---|
| 189 |  S CITY=$E(CITY,1,15)
 | 
|---|
| 190 |  I CITY'="",ST'="" S CITY=CITY_","
 | 
|---|
| 191 |  S CITY=CITY_$E(ST,1,2)
 | 
|---|
| 192 |  ;
 | 
|---|
| 193 |  S EDI=$G(^DIC(36,INS,3))
 | 
|---|
| 194 |  S PROF=$P(EDI,U,2),INST=$P(EDI,U,4)
 | 
|---|
| 195 |  S PYRID=$E(PROF,1,5)
 | 
|---|
| 196 |  I PROF'="",INST'="" S PYRID=PYRID_"/"
 | 
|---|
| 197 |  S PYRID=PYRID_$E(INST,1,5)
 | 
|---|
| 198 |  ;
 | 
|---|
| 199 |  W ?27,$E(L1,1,20)        ; address line 1
 | 
|---|
| 200 |  W ?47,"  ",CITY          ; city,state
 | 
|---|
| 201 |  W ?67,"  ",PYRID         ; payer IDs
 | 
|---|
| 202 | INSLISTX ;
 | 
|---|
| 203 |  Q
 | 
|---|
| 204 |  ;
 | 
|---|