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

IBCNSUR4.m

Go to the documentation of this file.
  1. IBCNSUR4 ;ALB/VD - SELECT MULTIPLE SUBSCRIBERS LOOK-UP UTILITY ; 14-APR-15
  1. ;;2.0;INTEGRATED BILLING;**549**;14-APR-15;Build 54
  1. ;;Per VA Directive 6402, this routine should not be modified.
  1. ;;
  1. ;
  1. EN(IBC1,IBP1,IBDD,IBSBID,IBVAL,IBSUBACT,IBEFDT,IBEFDT1,IBEFDT2) ; Entry Point
  1. ; Look-up Utility to Select Multiple Subscribers
  1. ; Input: IBC1 -- Pointer to the company in file #36
  1. ; IBP1 -- Pointer to the plan in file #355.3
  1. ; IBDD -- Deceased Subscribers Indicator (1 - Include
  1. ; Deceased, 0 - Ignore Deceased)
  1. ; IBSBID -- Subscriber ID Filter (1 - Use IBVAL to filter
  1. ; Subscriber IDs, 0 - Ignore Subscriber IDs)
  1. ; IBVAL -- Use the contained value to screen Subscriber IDs.
  1. ; IBSUBACT -- Subscriber Filter for Active Indicator (0 - Ignore
  1. ; Active Status, 1 - Filter Active, 2 - Filter Inactive)
  1. ; to be excluded from selection
  1. ; IBEFDT -- Effective Date Filter Indicator (1 - Use Effective
  1. ; Dates as a filter, 0 - Ignore Effective Dates.)
  1. ; IBEFDT1 -- Effective Date Filter Start Date.
  1. ; IBEFDT2 -- Effective Date Filter End Date.
  1. ;
  1. ; Output: IBCNT -- Number of Subscriber Policies to Move.
  1. ; ^TMP("IBCNSUR4A,$J) - Array of selected Subscribers.
  1. D EN^VALM("IBCN SUBSCRIBER SELECTOR")
  1. I +$G(IBFASTXT) S IBQUIT=1
  1. Q +$G(NUMSEL)_U_+$G(IBSUB)
  1. ;
  1. HDR(SELECTED) ;EP
  1. ; Header code for the Subscriber Selection template
  1. ; Input: SELECTED -- 1=Showing header for selected listman
  1. ; 0=Is the default or optional value
  1. ;
  1. ; IBC1 -- Pointer to the company in file #36
  1. ; IBP1 -- Pointer to the plan in file #355.3
  1. ; IBDD -- Deceased Subscribers Indicator (1 - Include
  1. ; Deceased, 0 - Ignore Deceased)
  1. ; IBSBID -- Subscriber ID Filter (1 - Use IBVAL to filter
  1. ; Subscriber IDs, 0 - Ignore Subscriber IDs)
  1. ; IBVAL -- Use the contained value to screen Subscriber IDs.
  1. ; IBSUBACT -- Subscriber Filter for Active Indicator (0 - Ignore
  1. ; Active Status, 1 - Filter Active, 2 - Filter Inactive)
  1. ; to be excluded from selection
  1. ; IBACTV -- List of Active or Inactive policies.
  1. ; IBEFDT -- Effective Date Filter Indicator (1 - Use Effective
  1. ; Dates as a filter, 0 - Ignore Effective Dates.)
  1. ; IBEFDT1 -- Effective Date Filter Start Date.
  1. ; IBEFDT2 -- Effective Date Filter End Date.
  1. ;
  1. ; Output: VALMHDR -- Header information to display
  1. N HCTR
  1. S:$G(IBSORT)="" IBSORT="1^Patient Name"
  1. S VALMHDR(1)="Subscribers in: "_$$GET1^DIQ(36,+IBC1,.01),$E(VALMHDR(1),50,79)="Grp Name: "_$$GET1^DIQ(355.3,+IBP1,.03)
  1. S VALMHDR(2)=$E($$GET1^DIQ(36,+IBC1,.111),1,20)_" "_$E($$GET1^DIQ(36,+IBC1,.114),1,20) ; Address and City
  1. S VALMHDR(2)=VALMHDR(2)_", "_$P($G(^DIC(5,+$$GET1^DIQ(36,+IBC1,.115,"I"),0)),U,2)_" "_$E($$GET1^DIQ(36,+IBC1,.116),1,5) ; ST Zip.
  1. S $E(VALMHDR(2),53,99)="Grp #: "_$$GET1^DIQ(355.3,+IBP1,.04)
  1. ;
  1. S VALMHDR(3)=+$G(NUMSEL)_" Subscriber"_$S(+$G(NUMSEL)=1:"",1:"s")_" selected out of "_+$G(IBSUB),$E(VALMHDR(3),50,99)="Sorted by: "_$P(IBSORT,U,2)
  1. S HCTR=4
  1. S VALMHDR(HCTR)="Filters: "_$S(IBDD=1:"Living PATs",1:"All PATs")
  1. I $L(IBVAL) S VALMHDR(HCTR)=VALMHDR(HCTR)_", SubIDs w/'"_IBVAL_"'"
  1. I $L(VALMHDR(HCTR))>57 S HCTR=HCTR+1
  1. I '$D(VALMHDR(HCTR)) S VALMHDR(HCTR)=" "
  1. S VALMHDR(HCTR)=VALMHDR(HCTR)_$S(IBSUBACT=1:", Active",IBSUBACT=2:", Inactive",IBSUBACT=3:", All",1:$S(+IBSUBACT:"",1:", All"))_" Policies"
  1. I $L(VALMHDR(HCTR))>46 S HCTR=HCTR+1
  1. I +IBEFDT D
  1. . I '$D(VALMHDR(HCTR)) S VALMHDR(HCTR)=" "
  1. . S VALMHDR(HCTR)=VALMHDR(HCTR)_", Eff "_$$DAT1^IBOUTL(IBEFDT1)_"-"_$$DAT1^IBOUTL(IBEFDT2)
  1. Q
  1. ;
  1. INIT ;EP
  1. ; Initialize variables and list array
  1. ; Input: None
  1. ; Output: ^TMP("IBCNSUR4",$J) - Body lines to display
  1. K ^TMP("IBCNSUR4",$J),^TMP("IBCNSUR4IX",$J),^TMP("IBCNSUR4A",$J)
  1. S:$G(IBSORT)="" IBSORT="1^Patient Name"
  1. D BLD
  1. Q
  1. ;
  1. BLD ; Build listman body
  1. ; Input: IBC1 -- Pointer to the company in file #36
  1. ; IBP1 -- Pointer to the plan in file #355.3
  1. ; IBDD -- Deceased Subscribers Indicator (1 - Include
  1. ; Deceased, 0 - Ignore Deceased)
  1. ; IBSBID -- Subscriber ID Filter (1 - Use IBVAL to filter
  1. ; Subscriber IDs, 0 - Ignore Subscriber IDs)
  1. ; IBVAL -- Use the contained value to screen Subscriber IDs.
  1. ; IBSUBACT -- Subscriber Filter for Active Indicator (0 - Include
  1. ; Both Active & Inactive, 1 - Include Active,
  1. ; 2 - Include Inactive) to be included in selection.
  1. ; IBACTV -- List of Active or Inactive policies.
  1. ; IBEFDT -- Effective Date Filter Indicator (1 - Use Effective
  1. ; Dates as a filter, 0 - Ignore Effective Dates.)
  1. ; IBEFDT1 -- Effective Date Filter Start Date.
  1. ; IBEFDT2 -- Effective Date Filter End Date.
  1. ; Output: VALMCNT - Total number of lines displayed in the body
  1. ; ^TMP("IBCNSUR4",$J) - Body lines to display
  1. ; ^TMP("IBCNSUR4IX",$J) - Index of Entry IENs by display line
  1. ;
  1. N ACTIVE,CURCNT,DFN,DFNY,OMIT,PATEFF,PATEXP,PATID,PATNAM,PATSID,PATSSN,PATWHO
  1. N SORTED,SRTKEY1,SRTKEY2,SRTKEY3,SRTREC,Y
  1. S IBSUB=$$SUBS^IBCNSJ(IBC1,IBP1,0,"^TMP($J,""IBCNSURS"")")
  1. S (CURCNT,VALMCNT)=0
  1. I '+IBSUB S ^TMP("IBCNSUR4",$J,1,0)="* This group plan has no subscribers!" Q
  1. I IBSUB D
  1. . S DFN=""
  1. . F S DFN=$O(^TMP($J,"IBCNSURS",DFN)) Q:DFN="" D
  1. . . S Y=""
  1. . . F S Y=$O(^TMP($J,"IBCNSURS",DFN,Y)) Q:Y="" D
  1. . . . S OMIT=0,DFNY=DFN_"~"_Y
  1. . . . D GTSREC(DFNY,.SRTREC)
  1. . . . S PATSID=$P(SRTREC,U,2),PATEFF=$P(SRTREC,U,3),PATEXP=$P(SRTREC,U,4)
  1. . . . S ACTIVE=$S('PATEXP:1,DT>+PATEXP:0,1:1)
  1. . . . I +IBDEAD,+$$GET1^DIQ(2,DFN_",",.351,"I") Q ; If ignoring deceased and subscriber is deceased exclude.
  1. . . . I +IBSUBID,$L(IBVALUE),($$UP^XLFSTR(PATSID)'[IBVALUE) Q ; Sub ID doesn't contain the Sub ID screen exclude.
  1. . . . I +IBSUBACT D Q:OMIT ; Active vs Inactive
  1. . . . . I IBSUBACT=1,'ACTIVE S OMIT=1 Q ; Include active Policies.
  1. . . . . I IBSUBACT=2,+ACTIVE S OMIT=1 ; Include inactive Policies.
  1. . . . I +IBEFDT D Q:OMIT ; Effective Date
  1. . . . . I PATEFF<IBEFDT1 S OMIT=1 Q ; Effective date is less than starting date.
  1. . . . . I PATEFF>IBEFDT2 S OMIT=1 ; Effective date is less than ending date.
  1. . . . I '$D(IBSORT) S IBSORT=1
  1. . . . S SRTKEY1=$P(SRTREC,U,IBSORT)
  1. . . . S SRTKEY2=$P(SRTREC,U,1) ; PATNAM
  1. . . . S SRTKEY3=$O(SORTED(SRTKEY1,SRTKEY2,""),-1)+1
  1. . . . S SORTED(SRTKEY1,SRTKEY2,SRTKEY3)=SRTREC
  1. . . . ;
  1. . S SRTKEY1=""
  1. . F S SRTKEY1=$O(SORTED(SRTKEY1)) Q:SRTKEY1="" D
  1. . . S SRTKEY2=""
  1. . . F S SRTKEY2=$O(SORTED(SRTKEY1,SRTKEY2)) Q:SRTKEY2="" D
  1. . . . S SRTKEY3=""
  1. . . . F S SRTKEY3=$O(SORTED(SRTKEY1,SRTKEY2,SRTKEY3)) Q:SRTKEY3="" D
  1. . . . . S SRTREC=SORTED(SRTKEY1,SRTKEY2,SRTKEY3)
  1. . . . . S DFNY=$P(SRTREC,U,8),DFN=$P(DFNY,"~",1),Y=$P(DFNY,"~",2)
  1. . . . . S CURCNT=CURCNT+1
  1. . . . . S LINE=$$BLDLN(CURCNT,DFN,Y,SRTREC)
  1. . . . . S VALMCNT=VALMCNT+1
  1. . . . . D SET^VALM10(VALMCNT,LINE,LINE)
  1. . . . . S ^TMP("IBCNSUR4IX",$J,CURCNT)=DFNY
  1. I IBSUB S IBSUB=CURCNT
  1. I VALMCNT=0 D
  1. . S ^TMP("IBCNSUR4",$J,1,0)="No Subscribers with Selection Criteria were found."
  1. Q
  1. ;
  1. GTSREC(DFNY,SRTREC) ; Get the sort record data
  1. N DFN,PATEFF,PATEXP,PATID,PATNAM,PATSID,PATSSN,PATWHO,Y
  1. S SRTREC=""
  1. S DFN=$P(DFNY,"~",1),Y=$P(DFNY,"~",2)
  1. S PATNAM=$$GET1^DIQ(2,DFN_",",.01),PATNAM=$S($L(PATNAM):PATNAM,1:" ")
  1. S PATSSN=$E($$GET1^DIQ(2,DFN_",",.09),6,9),PATSSN=$S($L(PATSSN):PATSSN,1:" ")
  1. S PATSID=$E($$GET1^DIQ(2.312,Y_","_DFN_",",7.02),1,20),PATSID=$S($L(PATSID):PATSID,1:" ") ;Only use the 1st 20 chars of SUBID.
  1. S PATEFF=$$GET1^DIQ(2.312,Y_","_DFN_",",8,"I"),PATEFF=$S($L(PATEFF):PATEFF,1:" ")
  1. S PATEXP=$$GET1^DIQ(2.312,Y_","_DFN_",",3,"I"),PATEXP=$S($L(PATEXP):PATEXP,1:" ")
  1. S PATWHO=$$GET1^DIQ(2.312,Y_","_DFN_",",6),PATWHO=$S('$L(PATWHO):"UNK",1:$E(PATWHO,1,3))
  1. S PATID=$$GET1^DIQ(2.312,Y_","_DFN_",",5.01),PATID=$S($L(PATID):PATID,1:" ")
  1. S SRTREC=PATNAM_U_PATSID_U_PATEFF_U_PATEXP_U_PATWHO_U_PATID_U_PATSSN_U_DFNY
  1. Q
  1. ;
  1. BLDLN(ICTR,DFN,Y,SRTREC) ;EP
  1. ; Also called from BLD^IBCNEILK2
  1. ; Builds a line to display one Subscriber
  1. ; Input: ICTR - Selection Number
  1. ; DFN - DFN of the Subscriber to be displayed
  1. ; Y - Y of the 2.312 occurrence.
  1. ; ^TMP("IBCNSUR4A",$J,DFN,Y) - Array of currently selected Subscribers
  1. ; Output: LINE - Formatted for setting into the list display
  1. N LINE,LINEI,XXN
  1. S:$D(^TMP("IBCNSUR4A",$J,DFN,Y)) ICTR=ICTR_">" ; Mark as selected
  1. S LINE=$$SETSTR^VALM1(ICTR,"",1,4) ; Selection #
  1. S LINE=$$SETSTR^VALM1($E($P(SRTREC,U,1),1,15),LINE,6,20) ; Patient Name
  1. S LINE=$$SETSTR^VALM1($S($P(SRTREC,U,7)=-9999:" ",1:$P(SRTREC,U,7)),LINE,22,25) ; SSN
  1. S LINE=$$SETSTR^VALM1($S($P(SRTREC,U,2)=-9999:" ",1:$E($P(SRTREC,U,2),1,20)),LINE,27,46) ; Subscriber ID (first 20 chars)
  1. S LINE=$$SETSTR^VALM1($S($P(SRTREC,U,3)=-9999:" ",1:$$DAT1^IBOUTL($P(SRTREC,U,3))),LINE,48,55) ; Effective Date
  1. S LINE=$$SETSTR^VALM1($S($P(SRTREC,U,4)=-9999:" ",1:$$DAT1^IBOUTL($P(SRTREC,U,4))),LINE,57,64) ; Expiration Date
  1. S LINE=$$SETSTR^VALM1($P(SRTREC,U,5),LINE,66,68) ; Whose
  1. S LINE=$$SETSTR^VALM1($S($P(SRTREC,U,6)=-9999:" ",1:$E($P(SRTREC,U,6),1,30)),LINE,71,100) ; Patient ID
  1. Q LINE
  1. ;
  1. HELP ;EP
  1. ; Help code
  1. ; Input: None
  1. D FULL^VALM1
  1. S VALMBCK="R"
  1. W @IOF,"A '>' after the Subscriber Selection number indicates that this Subscriber"
  1. W !,"has already been selected."
  1. Q
  1. ;
  1. EXIT ;EP
  1. ; Exit code
  1. ; Input: None
  1. K IBSORT,^TMP("IBCNSUR4",$J),^TMP("IBCNSUR4IX",$J)
  1. D CLEAR^VALM1
  1. Q
  1. ;
  1. SEL ;EP
  1. ; Protocol Action to de-select an already selected Subscriber
  1. ; Input: NUMSEL - Current number of selected Subscribers
  1. ; ^TMP("IBCNSUR4",$J) - Current Array of displayed Subscribers
  1. ; ^TMP("IBCNSUR4IX",$J) - Current Index of displayed Subscribers
  1. ; ^TMP("IBCNSUR4A,$J,DFN,Y) - Current Array of selected Subscribers
  1. ;
  1. ; Output: NUMSEL - Updated number of selected Subscribers
  1. ; ^TMP("IBCNSUR4A,$J,DFN,Y) - Updated Array of selected Subscribers
  1. ; Selected Subscriber is removed from the worklist
  1. ; Error message displayed (potentially)
  1. N DFN,DFNS,DFNY,DIR,DIROUT,DIRUT,DLINE,DTOUT,DUOUT,ERROR,IX,LINE,PROMPT,Y
  1. S VALMBCK="R",ERROR=0
  1. ;
  1. ; First select the Subscriber(s) to be selected
  1. S PROMPT="Select Subscriber(s)"
  1. S DFNS=$$SELSUB(1,PROMPT,.DLINE,1,"IBCNSUR4IX")
  1. I DFNS="" S VALMBCK="R" Q ; None Selected
  1. F IX=1:1:$L(DFNS,",") D
  1. . S DFNY=$P(DFNS,",",IX)
  1. . S DFN=$P(DFNY,"~",1)
  1. . S Y=$P(DFNY,"~",2)
  1. . S LINE=$P(DLINE,",",IX)
  1. . ;
  1. . ; If currently selected, display an error message
  1. . I $D(^TMP("IBCNSUR4A",$J,DFN,Y)) D Q
  1. . . W !,*7,">>>> # ",LINE," is currently selected."
  1. . . S ERROR=1
  1. . D MARK(1,DFNY,LINE,.NUMSEL) ; Show the selection mark
  1. D HDR ; Update the header
  1. D:ERROR PAUSE^VALM1
  1. Q
  1. ;
  1. UNSEL(SELECTED) ;EP
  1. ; Protocol Action to de-select an already selected Subscriber
  1. ; Input:
  1. ; Optional, defaults to 0
  1. ; NUMSEL - Current number of selected Subscribers
  1. ; ^TMP("IBCNSUR4",$J) - Current Array of displayed Subscribers
  1. ; ^TMP("IBCNSUR4S",$J) - Current Array of selected Insurance Companies
  1. ; ^TMP("IBCNSUR4IX",$J) - Current Index of displayed Subscribers
  1. ; ^TMP("IBCNSUR4A,$J,DFN,Y) - Current Array of selected Subscribers
  1. ;
  1. ; Output: NUMSEL - Current number of selected Subscribers
  1. ; ^TMP("IBCNSUR4A,$J,DFN,Y) - Updated Array of selected Subscribers
  1. ;
  1. ; Selected Subscriber is removed from the worklist
  1. ; Error message displayed (potentially)
  1. N DFN,DFNS,DFNY,DIR,DIROUT,DIRUT,DLINE,DTOUT,DUOUT,ERROR,IX,LINE,MSG,PROMPT,WARRAY,Y
  1. I '$D(SELECTED) D
  1. . S SELECTED=0,WARRAY="IBCNSUR4IX"
  1. E S WARRAY="IBCNSUR4SIX"
  1. S VALMBCK="R",ERROR=0
  1. ;
  1. ; First select the Subscriber(s) to be de-selected
  1. S PROMPT="De-Select Subscriber(s)"
  1. S MSG="Are you sure you want to De-Select "
  1. S DFNS=$$SELSUB(1,PROMPT,.DLINE,1,WARRAY)
  1. I DFNS="" S VALMBCK="R" Q ; None Selected
  1. F IX=1:1:$L(DFNS,",") D
  1. . S DFNY=$P(DFNS,",",IX)
  1. . S DFN=$P(DFNY,"~",1)
  1. . S Y=$P(DFNY,"~",2)
  1. . S LINE=$P(DLINE,",",IX)
  1. . ;
  1. . ; If not currently selected, display an error message
  1. . I '$D(^TMP("IBCNSUR4A",$J,DFN,Y)) D Q
  1. . . W !,*7,">>>> # ",LINE," is not currently selected. It cannot be de-selected."
  1. . . S ERROR=1
  1. . D MARK(0,DFNY,LINE,.NUMSEL) ; De-Select the entry
  1. D HDR ; Update the header
  1. D:ERROR PAUSE^VALM1
  1. Q
  1. ;
  1. MARK(WHICH,DFNY,LINE,NUMSEL) ; Mark/Remove 'Selection' from a selected
  1. ; Subscriber line
  1. ; Input: WHICH - 0 - Remove 'Selection' mark
  1. ; 1 - Set 'Selection' mark
  1. ; DFNY - DFN and Y of the entry to Mark/Remove 'In-Progress'
  1. ; LINE - Line number being marked/unmarked
  1. ; WLIST - Worklist, the user is selecting from.
  1. ; NUMSEL - Current # of selected Subscriber
  1. ; ^TMP("IBCNSUR4A",$J)- Current array of selected Subscriber
  1. ; Output: Subscriber is marked or unmarked as selected
  1. ; NUMSEL - Current # of selected Subscribers
  1. ; ^TMP("IBCNSUR4A",$J)- Updated array of selected Subscribers
  1. ;
  1. N TEXT,DFN,Y
  1. S DFN=$P(DFNY,"~",1)
  1. S Y=$P(DFNY,"~",2)
  1. I WHICH D ; Mark as selected
  1. . S ^TMP("IBCNSUR4A",$J,DFN,Y)=""
  1. . S TEXT=LINE_">",NUMSEL=NUMSEL+1
  1. E D ; Mark as unselected
  1. . K ^TMP("IBCNSUR4A",$J,DFN,Y)
  1. . S TEXT=LINE,NUMSEL=NUMSEL-1
  1. D FLDTEXT^VALM10(LINE,"CTR",TEXT) ; Update display
  1. D WRITE^VALM10(LINE) ; Redisplay line
  1. Q
  1. ;
  1. SHOWSEL ;EP
  1. ; Protocol action used to display a listman template of the currently
  1. ; selected Subscribers
  1. ; Input: NUMSEL - Current number of selected Subscribers
  1. ; ^TMP("IBCNSUR4A",$J,DFN,Y) - Current Array of selected Subscribers
  1. ; Output: NUMSEL - Updated number of selected Subscribers
  1. ; ^TMP("IBCNSUR4A",$J,DFN,Y) - Updated Array of selected Subscribers
  1. S VALMBCK="R"
  1. D EN^VALM("IBCN SUBSCRIBER SELECTED")
  1. D HDR,BLD
  1. Q
  1. ;
  1. SELSUB(FULL,PROMPT,DLINE,MULT,WLIST) ;EP
  1. ; Select Subscriber(s) to perform an action upon
  1. ; Input: FULL - 1 - full screen mode, 0 otherwise
  1. ; PROMPT - Prompt to be displayed to the user
  1. ; MULT - 1 to allow multiple entry selection
  1. ; 0 to only allow single entry selection
  1. ; Optional, defaults to 0
  1. ; WLIST - Worklist, the user is selecting from
  1. ; ^TMP("IBCNSUR4IX",$J) - Index of displayed lines of the Subscriber
  1. ; Selector Template.
  1. ; Only used when WLIST="IBCNSUR4IX"
  1. ; ^TMP("IBCNSUR4SIX",$J) - Index of displayed lines of the Subscriber
  1. ; Selected Template
  1. ; Only used if WLIST is "IBCNSUR4IX"
  1. ; Output: DLINE - Comma delimited list of Line #(s) of the
  1. ; selected Subscriber
  1. ; Returns: IEN(s) - Comma delimited string or IENS for the selected Subscriber(s)
  1. ; Error message and "" DFNS if multi-selection and not allowed
  1. N DFNY,DFNS,DIR,DIROUT,DIRUT,DTOUT,DUOUT,IX,VALMY,X,Y
  1. S:'$D(MULT) MULT=0
  1. S:'$D(WLIST) WLIST="IBCNSUR4"
  1. D:FULL FULL^VALM1
  1. S DLINE=$P($P($G(XQORNOD(0)),"^",4),"=",2) ; User selection with action
  1. S DLINE=$TR(DLINE,"/\; .",",,,,,") ; Check for multi-selection
  1. S DFNS=""
  1. I 'MULT,DLINE["," D Q "" ; Invalid multi-selection
  1. . W !,*7,">>>> Only single entry selection is allowed"
  1. . S DLINE=""
  1. . K DIR
  1. . D PAUSE^VALM1
  1. ;
  1. ; Let the user enter their selection(s)
  1. D EN^VALM2($G(XQORNOD(0)),"O") ; ListMan generic selector
  1. I '$D(VALMY) Q ""
  1. S IX="",DLINE=""
  1. F D Q:IX=""
  1. . S IX=$O(VALMY(IX))
  1. . Q:IX=""
  1. . S DLINE=$S(DLINE="":IX,1:DLINE_","_IX)
  1. . S DFNY=$G(^TMP(WLIST,$J,IX))
  1. . S DFNS=$S(DFNS="":DFNY,1:DFNS_","_DFNY)
  1. Q DFNS
  1. ;
  1. INIT2 ;EP for Show Selections
  1. ; Initialize variables and list array
  1. ; Input: None
  1. ; Output: ^TMP("IBCNSUR4",$J) - Body lines to display
  1. K ^TMP("IBCNSUR4S",$J),^TMP("IBCNSUR4SIX",$J)
  1. D BLD2
  1. Q
  1. ;
  1. BLD2 ; Build listman body for Show Selections
  1. ; Input: None
  1. ; Output: VALMCNT - Total number of lines displayed in the body
  1. ; ^TMP("IBCNSUR4S",$J) - Body lines to display
  1. ; ^TMP("IBCNSUR4SIX",$J) - Index of Entry DFNs by display line
  1. N DFN,DFNY,ICTR,LINE,SORTED,SRTKEY1,SRTKEY2,SRTKEY3,Y
  1. ;
  1. ; First sort the currently selected Subscribers into name order
  1. S DFN=""
  1. F S DFN=$O(^TMP("IBCNSUR4A",$J,DFN)) Q:DFN="" D
  1. . S Y=""
  1. . F S Y=$O(^TMP("IBCNSUR4A",$J,DFN,Y)) Q:Y="" D
  1. . . S DFNY=DFN_"~"_Y
  1. . . D GTSREC(DFNY,.SRTREC)
  1. . . S SRTKEY1=$P(SRTREC,U,IBSORT)
  1. . . S SRTKEY2=$P(SRTREC,U,1) ; PATNAM
  1. . . S SRTKEY3=$O(SORTED(SRTKEY1,SRTKEY2,""),-1)+1
  1. . . S SORTED(SRTKEY1,SRTKEY2,SRTKEY3)=SRTREC
  1. ;
  1. ; Now build the lines to be displayed
  1. S (ICTR,VALMCNT)=0,SRTKEY1=""
  1. F S SRTKEY1=$O(SORTED(SRTKEY1)) Q:SRTKEY1="" D
  1. . S SRTKEY2=""
  1. . F S SRTKEY2=$O(SORTED(SRTKEY1,SRTKEY2)) Q:SRTKEY2="" D
  1. . . S SRTKEY3=""
  1. . . F S SRTKEY3=$O(SORTED(SRTKEY1,SRTKEY2,SRTKEY3)) Q:SRTKEY3="" D
  1. . . . S SRTREC=SORTED(SRTKEY1,SRTKEY2,SRTKEY3)
  1. . . . S DFNY=$P(SRTREC,U,8)
  1. . . . S DFN=$P(DFNY,"~",1),Y=$P(DFNY,"~",2)
  1. . . . S ICTR=ICTR+1
  1. . . . S LINE=$$BLDLN(ICTR,DFN,Y,SRTREC)
  1. . . . S VALMCNT=VALMCNT+1
  1. . . . D SET^VALM10(VALMCNT,LINE,LINE)
  1. . . . S ^TMP("IBCNSUR4SIX",$J,ICTR)=DFN_"~"_Y
  1. ;
  1. I VALMCNT=0 D
  1. . S ^TMP("IBCNSUR4",$J,1,0)="No Selected Subscribers were found."
  1. Q
  1. ;
  1. EXIT2 ;EP for Show Selections
  1. ; Exit code
  1. ; Input: None
  1. K ^TMP("IBCNSUR4S",$J),^TMP("IBCNSUR4SIX",$J)
  1. D CLEAR^VALM1
  1. Q
  1. ;
  1. SELSORT ; select the way to sort the list screen
  1. N DIR,DIRUT,X,Y,DTOUT,DUOUT,DIROUT,ST,STDES
  1. ;
  1. D FULL^VALM1 W !
  1. W !,"Select the item to sort the subscriber records on the subscriber list screen."
  1. S DIR(0)="SO^1:Patient Name;2:Subscriber ID;3:Effective Date;4:Date Expired;5:Whose;6:Patient ID"
  1. S DIR("A")="Sort the list by",DIR("B")=$P($G(IBSORT),"^",2)
  1. D ^DIR K DIR
  1. I 'Y G SELSORTX
  1. S IBSORT=Y_"^"_Y(0)
  1. ;
  1. ; rebuild and resort the list and update the list header
  1. D BLD,HDR
  1. ;
  1. SELSORTX ;
  1. S VALMBCK="R",VALMBG=1
  1. Q
  1. ;