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

IBCNOR1.m

Go to the documentation of this file.
  1. IBCNOR1 ;AITC/DTG - PATIENT MISSING COVERAGE REPORT ;08/14/23
  1. ;;2.0;INTEGRATED BILLING;**771**;21-MAR-94;Build 26
  1. ;;Per VA Directive 6402, this routine should not be modified.
  1. ;
  1. ; ICR #1519-For using the KERNEL routine XUTMDEVQ
  1. ;
  1. Q
  1. EN ; entry point
  1. ;
  1. ; IBCNOR("IBI") = select INS 0 some, 1 all
  1. ; IBCNOR("IBIA") = only 1-Active Insurance Companies
  1. ; IBCNOR("IBIG") = 0-Selected, 1-All Group Plans
  1. ; IBCNOR("IBIGA")= only 1-Active Group Plans
  1. ; IBCNOR("IBIGN")= 1-Group Name, 2-Group Number, 3-Both Group Name and Group Number
  1. ; IBCNOR("IBFIL")= A^B^C where"
  1. ; A - 1-Begin with, 2-Contains, 3-Range
  1. ; B - A=1 Begin with text, A=2 Contains text, A=3 Range start text
  1. ; C - only if A=3 Range End text
  1. ; IBCNOR("IBOUT") E-EXCEL, R-REPORT
  1. ;
  1. W !!,"This report allows the user to list patients who have an active medical"
  1. W !,"policy/coverage and are missing an active pharmacy policy/coverage.",!!
  1. ;
  1. N DIC,DIR,INACT,IBARRAY,IBB,IBCNOR,IBCNS,IBFILTER,IBLEVEL,IBI36,IBINAME
  1. N IBINM,IBINSLNM,IBITYP,IBOK,IBOK1,IBQUIT,IBRF,IBRFU,IBRL,IBSORT,IBTMP,IBTYP,IBXTFEED
  1. N IBRLU,IBSCR,IBSTOP,IIEN,INSCT,INSNAME,NGFLG,NGFND,POP,X,Y
  1. S (IBSTOP,IBQUIT)=""
  1. S IBCNOR("IBIA")=1 ;only active insurance companies
  1. S IBCNOR("IBIGA")=1 ;only active group plans
  1. ;
  1. Q10 ; ask ins
  1. K IBARRAY
  1. K ^TMP("IBCNOR",$J,"INS"),^TMP($J,"IBCNOR")
  1. S IBSTOP=0 D SELI
  1. I IBSTOP G EXIT
  1. I 'IBCNOR("IBI") D
  1. . N IBCNS,INSCT
  1. . D EN^IBCNILK(1) ; active only
  1. . I '$D(^TMP("IBCNILKA",$J)) S IBQUIT=1 Q ; No Insurance Companies selected
  1. . K ^TMP($J,"IBCNOR","ILK") M ^TMP($J,"IBCNOR","ILK")=^TMP("IBCNILKA",$J)
  1. . S INSCT=0
  1. . S IBCNS="" F S IBCNS=$O(^TMP("IBCNILKA",$J,IBCNS)) Q:IBCNS="" D
  1. . . S INSCT=INSCT+1
  1. . . ; Add SELECTED Insurance Companies, add to ^TMP("IBCNOR")
  1. . . S ^TMP("IBCNOR",$J,"INS",INSCT)=IBCNS
  1. ;
  1. I IBQUIT W !!,"** No Insurance Companies selected! **",!! S DIR(0)="E" D ^DIR K DIR G EXIT
  1. ;
  1. ; If ALL Insurance Companies, add to ^TMP("IBCNOR")
  1. I IBCNOR("IBI") D G Q50
  1. . S INSCT=0
  1. . S IBCNOR("IBIG")=1 ; default to all groups/plans of chosen insurance
  1. . S IBCNOR("IBIGN")=3 ; default to both name and number for groups/plans
  1. . S IBCNOR("IBFIL")="3^A^Z" ; default to groups in range from A to Z
  1. ;
  1. Q20 ; ask group
  1. ;
  1. S IBSTOP=0 D SELG I IBSTOP G EXIT
  1. ; No Groups found (NGFND=1), type enter to continue and exit
  1. I $G(NGFND)=1 S DIR(0)="E" D ^DIR K DIR G EXIT
  1. ;
  1. I IBCNOR("IBIG") D G Q50 ; skip around when all groups/plans are selected
  1. . S IBCNOR("IBIGN")=3 ; default to both name and number for groups/plans
  1. . S IBCNOR("IBFIL")="3^A^Z" ; default to groups in range from A to Z
  1. ;
  1. K ^TMP($J,"IBCNOR","ILK") M ^TMP($J,"IBCNOR","ILK")=^TMP("IBCNILKA",$J)
  1. Q30 ; Group Name/Group Number/Both filter
  1. S IBSTOP=0 D SELGN I IBSTOP G EXIT
  1. ;
  1. Q40 ; type of group
  1. ; Group(s)that Begin/Contain/Range XXX
  1. S (IBQUIT,IBSTOP)=0
  1. S IBFILTER=$$SELFILT^IBCNOR1()
  1. I +IBFILTER<0 S IBSTOP=1
  1. I IBSTOP G EXIT
  1. S IBCNOR("IBFIL")=IBFILTER
  1. ;
  1. Q45 ; select groups if not all
  1. ;
  1. ;S (IBQUIT,IBSTOP)=0 I 'IBCNOR("IBIG") D I IBSTOP G:$$STOP EXIT G Q40
  1. S (IBQUIT,IBSTOP)=0 I 'IBCNOR("IBIG") D I IBSTOP G EXIT
  1. . ; loop through the insurance companies
  1. . N IBI,IBJ,IBN,IBSORT
  1. . K IBSORT
  1. . S IBI=0 F S IBI=$O(^TMP("IBCNOR",$J,"INS",IBI)) Q:'IBI D
  1. . . N IBNM
  1. . . S IBN=$G(^TMP("IBCNOR",$J,"INS",IBI)),IBNM=$$GET1^DIQ(36,IBN,.01)
  1. . . I IBNM="" Q
  1. . . S IBSORT(IBNM,IBN)=IBI
  1. . D BLDSELECT I IBQUIT!IBSTOP Q
  1. . ; go through insurances if no plans selected
  1. . N IBI,IBJ,IBN
  1. . S IBI="",IBN=0 F S IBI=$O(^TMP("IBCNOR",$J,"INS",IBI)) Q:'IBI D Q:IBN
  1. . . S IBJ="" F S IBJ=$O(^TMP("IBCNOR",$J,"INS",IBI,"GRP",IBJ)) Q:'IBJ S IBN=1
  1. . I 'IBN S IBSTOP=1 D Q
  1. . . W !," No Groups/Plans selected for the chosen insurances",!! S DIR(0)="E" D ^DIR K DIR
  1. ;
  1. Q50 ; ask patient
  1. ;
  1. S IBSTOP=0
  1. D NR ;patient name range
  1. I IBSTOP G EXIT
  1. ;
  1. Q60 ; check if all and ask to proceed
  1. S IBSTOP=0
  1. I (IBCNOR("IBIG")&(IBCNOR("IBI"))&((IBRF="")&(IBRL="zzzzzz")!(IBRFU="A"&IBRLU="Z"))) D SELALL
  1. I IBSTOP G EXIT
  1. ;
  1. Q70 ; Report or CSV output
  1. S IBSTOP=0 D OUT
  1. I IBSTOP G EXIT
  1. ;
  1. D DEVICE
  1. ;
  1. EXIT ; quit
  1. ;
  1. K ^TMP("IBCNOR",$J)
  1. K ^TMP($J,"IBSEL")
  1. ;
  1. Q
  1. ;
  1. ;
  1. SELI ; Prompt user to select all or subset of insurance companies
  1. ; Count insurance companies with plans
  1. ; Returns: 0 - User selects insurance companies
  1. ; 1 - Run report for all insurance companies with plans
  1. ; STOP=1 - No selection made
  1. ;
  1. N IBA,IBB,INACT
  1. S (IBA,IBB)=0
  1. F S IBA=$O(^IBA(355.3,"B",IBA)) Q:'IBA D
  1. . S INACT=+$$GET1^DIQ(36,IBA_",",.05,"I") ;1=Inactive, 0=Active
  1. . I 'INACT S IBB=IBB+1
  1. ;
  1. N DIR,DIROUT,DIRUT,DTOUT,DUOUT,X,Y
  1. W !
  1. S DIR(0)="SA^1:List All "_IBB_" Active Ins. Companies;2:List Only Active Ins. Companies That You Select"
  1. S DIR("A",1)="1 - List All "_IBB_" Active Ins. Companies"
  1. S DIR("A",2)="2 - List Only Active Ins. Companies That You Select"
  1. S DIR("A")=" SELECT 1 or 2: "
  1. S DIR("?",1)="Enter a code from the list: 1 or 2. Only active insurance"
  1. S DIR("?")="companies with one or more plans can be selected."
  1. D ^DIR K DIR
  1. I $D(DIROUT)!$D(DIRUT)!$D(DTOUT)!$D(DUOUT) S IBSTOP=1 G SELIQ
  1. S IBCNOR("IBI")=(+Y=1) K Y
  1. S IBCNOR("IBIA")=1
  1. SELIQ ;
  1. Q
  1. ;
  1. SELG ; Prompt user to select all or subset of group plans
  1. ; Count of group plans
  1. ; Returns: 0 - Selected Group Plans
  1. ; 1 - All Group Plans
  1. ; STOP=1 - No selection made
  1. ;
  1. N IBA,IBA0,IBCT,INACT,IBIN
  1. ;
  1. S IBCNOR("IBIG")=1
  1. S IBCNOR("IBIGA")=1
  1. ; Get count of Group Plans from Insurance Company(s), ALL or Selected
  1. S (NGFLG,NGFND)=0
  1. S IBCT=0
  1. S IBA0=0,IBINSLNM="" F S IBA0=$O(^TMP("IBCNOR",$J,"INS",IBA0)) Q:'IBA0 D
  1. . S IBA=^TMP("IBCNOR",$J,"INS",IBA0)
  1. . S IBINSLNM=$$GET1^DIQ(36,IBA_",",.01)
  1. . I '$D(^IBA(355.3,"B",IBA)) S NGFLG=1 Q
  1. . S IBB=0 F S IBB=$O(^IBA(355.3,"B",IBA,IBB)) Q:'IBB D
  1. . . S IBIN=+$$GET1^DIQ(355.3,IBB_",",.11,"I") I IBIN Q ; quit back if inactive flag set
  1. . . S IBCT=IBCT+1
  1. ;
  1. ; If there are no groups for the selected Ins Company(s),display the following and set NGFND=1
  1. I 'IBCNOR("IBI"),IBCT=0 D Q
  1. . W !!,"The selected Company(s) does not contain any Groups",!!
  1. . S NGFND=1,IBCNOR("IBIG")=0
  1. ;
  1. ; If there are No Groups found when one or more Ins Company(s) are selected
  1. ; display the following message
  1. I NGFLG W !!,"Some Selected Companies do not contain groups and will not display on the report"
  1. ;
  1. ;
  1. N DIR,DIROUT,DIRUT,DTOUT,DUOUT,X,Y
  1. W !
  1. S DIR(0)="SA^1:List All "_IBCT_" Active Group Plans;2:List Only Active Group Plans That You Select"
  1. S DIR("A",1)="1 - List All "_IBCT_" Active Group Plans"
  1. S DIR("A",2)="2 - List Only Active Group Plans That You Select"
  1. S DIR("A")=" SELECT 1 or 2: "
  1. S DIR("?",1)="Enter a code from the list: 1 or 2."
  1. S DIR("?")="One or more group plans can be selected."
  1. D ^DIR K DIR
  1. I $D(DIROUT)!$D(DIRUT)!$D(DTOUT)!$D(DUOUT) S IBSTOP=1 G SELGQ
  1. S IBCNOR("IBIG")=(+Y=1) K Y
  1. S IBCNOR("IBIGA")=1
  1. SELGQ ;
  1. Q
  1. ;
  1. SELGN ; Prompt user to select Group Name/Group Number/Both filter
  1. ; Returns: 1 - Group Name
  1. ; 2 - Group Number
  1. ; 3 - Both Group Name and Group Number
  1. ; -1 - No selection made
  1. ;
  1. N DIR,DIROUT,DIRUT,DTOUT,DUOUT,X,Y
  1. W !
  1. S DIR(0)="SA^1:GROUP NAME;2:GROUP NUMBER;3:BOTH"
  1. S DIR("A")=" Select 1 or 2 or 3: "
  1. S DIR("A",1)="1 - Select GROUP NAME"
  1. S DIR("A",2)="2 - Select GROUP NUMBER"
  1. S DIR("A",3)="3 - Select BOTH"
  1. S DIR("?",1)=" 1 - Only allow selection of GROUP NAME"
  1. S DIR("?",2)=" 2 - Only allow selection of GROUP NUMBER"
  1. S DIR("?")=" 3 - Allow selection of GROUP NAME and GROUP NUMBER"
  1. D ^DIR K DIR
  1. I $D(DIROUT)!$D(DIRUT)!$D(DTOUT)!$D(DUOUT) S IBSTOP=1 G SELGNQ
  1. S IBCNOR("IBIGN")=Y
  1. SELGNQ ;
  1. Q
  1. ;
  1. NR ; Ask Name Range
  1. N DIR,DIROUT,DIRUT,DTOUT,DUOUT,X,Y
  1. NRR ;
  1. W !!,"Enter Start With value or Press <ENTER> to start at the beginning of the list.",!
  1. S DIR(0)="FO",DIR("A")="START WITH PATIENT NAME"
  1. S DIR("?")="^D NRRHLP^IBCNOR1(""BEGIN"")"
  1. D ^DIR I ($D(DTOUT))!($D(DUOUT)) S IBSTOP=1 Q
  1. S IBRF=Y
  1. S IBRFU=$$UP^XLFSTR(IBRF)
  1. ;
  1. W !!,"Enter Go To value or Press <ENTER> to finish at the end of the list.",!
  1. S DIR(0)="FO",DIR("A")="GO TO PATIENT NAME"
  1. S DIR("?")="^D NRRHLP^IBCNOR1(""END"")"
  1. D ^DIR I ($D(DTOUT))!($D(DUOUT)) S IBSTOP=1 Q
  1. S:Y="" Y="zzzzzz" S IBRL=Y
  1. S IBRLU=IBRL I IBRL'="zzzzzz" S IBRLU=$$UP^XLFSTR(IBRL)
  1. I $G(IBRLU)']$G(IBRFU) W !!,?5,"* The Go to Patient Name must follow after the Start with Name. *",! G NRR
  1. Q
  1. ;
  1. NRRHLP(IBLEVEL) ; ?? Help for the Range Prompt
  1. W !!,?5,"Enter a value the Patient Name should ",IBLEVEL," with."
  1. I IBLEVEL="BEGIN" W !,?5,"Press <ENTER> to start at the beginning of the list."
  1. I IBLEVEL="END" W !,?5,"Press <ENTER> to finish at the end of the list."
  1. Q
  1. ;
  1. SELALL ; ask if user say run for all ins / groups / patients
  1. N DIR,DIROUT,DIRUT,DTOUT,DUOUT,X,Y
  1. W !
  1. S DIR(0)="Y",IBSTOP=0,DIR("B")="NO"
  1. S DIR("A",1)="WARNING: You have selected to run this report for all insurance companies,"
  1. S DIR("A",2)="all group plans, and all associated patients. In doing so, this report will"
  1. S DIR("A",3)="take a long time to run."
  1. S DIR("A",4)=" "
  1. S DIR("A")="Do you want to continue"
  1. S DIR("?")="Enter 'Y' to continue or 'N' to quit"
  1. D ^DIR K DIR
  1. I Y'="1" S Y=0
  1. I Y=0!($D(DIROUT)!$D(DIRUT)!$D(DTOUT)!$D(DUOUT)) S IBSTOP=1
  1. SELALLQ ; back
  1. Q
  1. ;
  1. DEVICE ;
  1. N I,POP,IBB
  1. W !!,"We recommend you queue this report as it will take awhile."
  1. I IBCNOR("IBOUT")="E" D
  1. . W !!,"For CSV output, turn logging or capture on now.",!
  1. ;
  1. ; IBCNOR = Array of Params
  1. N IBJOB,POP,ZTDESC,ZTRTN,ZTSAVE
  1. S ZTRTN="COMPILE^IBCNOR1A(""IBCNOR"",.IBCNOR)"
  1. S ZTDESC="PC - PATIENT MISSING COVERAGE REPORT"
  1. S ZTSAVE("^TMP(""IBCNOR"",$J,")=""
  1. S ZTSAVE("^TMP(""IBCNILKA"",$J,")=""
  1. S IBJOB=$J
  1. F IBB="IBCNOR(","IBJOB","IBRL","IBRLU","IBRF","IBRFU" S ZTSAVE(IBB)=""
  1. D EN^XUTMDEVQ(ZTRTN,ZTDESC,.ZTSAVE,"Q") ; ICR # 1519
  1. ;
  1. Q
  1. ENQ ;
  1. Q
  1. OUT ; Prompt to allow users to select output format
  1. ; Returns: E - Output to excel
  1. ; R - Output to report
  1. ; STOP=1 - No Selection made
  1. N DIR,DIROUT,DIRUT,DTOUT,DUOUT,X,Y
  1. W !
  1. S DIR(0)="SA^E:Excel;R:Report"
  1. S DIR("A")="(E)xcel Format or (R)eport Format: "
  1. S DIR("B")="Report"
  1. S DIR("?",1)="Select 'E' to create CSV output for import into Excel."
  1. S DIR("?")="Select 'R' to create a standard report."
  1. D ^DIR K DIR
  1. I $D(DIROUT)!$D(DIRUT)!$D(DTOUT)!$D(DUOUT) S IBSTOP=1 G OUTQ
  1. S IBCNOR("IBOUT")=Y
  1. OUTQ ;
  1. Q
  1. ;
  1. STOP() ; Determine if user wants to exit out of the whole option
  1. ; Init vars
  1. N DIR,X,Y,DIRUT
  1. ;
  1. W !
  1. S DIR(0)="Y"
  1. S DIR("A")="Do you want to exit out of this option entirely"
  1. S DIR("B")="YES"
  1. S DIR("?",1)=" Enter YES to immediately exit out of this option."
  1. S DIR("?")=" Enter NO to return to the previous question."
  1. D ^DIR K DIR
  1. I $D(DIRUT) S (IBSTOP,Y)=1 G STOPX
  1. I 'Y S IBSTOP=0
  1. ;
  1. STOPX ; STOP exit pt
  1. Q Y
  1. ;
  1. CHKINS(IBISN) ; check that insurance is allowed
  1. ;
  1. N IBA,IBB,IBC,IBL
  1. S IBOK=1
  1. S INACT=+$$GET1^DIQ(36,IBISN_",",.05,"I") ;1=Inactive, 0=Active
  1. S IBTYP=$$GET1^DIQ(36,IBISN_",",.13,"E")
  1. ; Is the Insurance Company Inactive?
  1. I INACT S IBOK=0 Q ; Ins Company is Inactive and looking for Active only
  1. ; check on type
  1. ;Ins type is skipped
  1. I IBTYP="MEDI-CAL" S IBOK=0 Q
  1. I IBTYP="MEDICAID" S IBOK=0 Q
  1. I IBTYP="TORT/FEASOR" S IBOK=0 Q
  1. I IBTYP="VA SPECIAL CLASS" S IBOK=0 Q
  1. I IBTYP="WORKERS' COMPENSATION" S IBOK=0 Q
  1. I IBTYP="INDEMNITY" S IBOK=0 Q
  1. I IBTYP="DISABILITY INCOME INSURANCE" S IBOK=0 Q
  1. I IBTYP="SUBSTANCE ABUSE ONLY" S IBOK=0 Q
  1. I IBTYP="MEDICARE" S IBOK=0 Q
  1. Q
  1. CHKNM(INSNAME) ; check name
  1. ; check on ins name
  1. S INSNAME=$G(INSNAME) I INSNAME="" S IBOK=0 Q
  1. N IBA,IBB,IBL,INSNAM
  1. S IBOK=1,INSNAM=$$UP^XLFSTR(INSNAME)
  1. I INSNAM["(WNR)" S IBOK=0 Q
  1. I INSNAM["MCR" S IBOK=0 Q
  1. I INSNAM["WNR" S IBOK=0 Q
  1. I INSNAM["MEDICARE" S IBOK=0 Q
  1. I INSNAM["MEDICAID" S IBOK=0 Q
  1. I INSNAM["CAMP LEJEUNE" S IBOK=0 Q
  1. I INSNAM["IVF" S IBOK=0 Q
  1. I INSNAM["VHA DIRECTIVE 1029" S IBOK=0 Q
  1. I INSNAM["CLAY HUNT" S IBOK=0 Q
  1. I INSNAM["DEPARTMENT OF LABOR" S IBOK=0 Q
  1. I INSNAM["REGIONAL COUNSEL" S IBOK=0 Q
  1. ;
  1. Q
  1. ;
  1. SELFILT() ; Group Plan filter
  1. ; Returns: A^B^C Where:
  1. ; A - 1 - Search for Group(s) that begin with
  1. ; the specified text (case insensitive)
  1. ; 2 - Search for Group(s) that contain
  1. ; the specified text (case insensitive)
  1. ; 3 - Search for Group(s) in a specified
  1. ; range (inclusive, case insensitive)
  1. ; 4 - Search for Group(s) that are BLANK or null
  1. ; B - Begin with text if A=1, Contains Text if A=2 or
  1. ; the range start if A=3
  1. ; C - Range End text (only present when A=3)
  1. ; -1 if a valid filter was not selected
  1. N DIR,DIROUT,DIRUT,DTOUT,DUOUT,FILTER,X,XX,Y
  1. ;
  1. ; First ask what kind of filter to use
  1. W !
  1. S DIR(0)="SA^1:Begins with;2:Contains;3:Range;4:Blank"
  1. S DIR("A")=" Select 1, 2, 3 or 4: "
  1. S DIR("A",1)="1 - Select Group(s) that Begin with: XXX"
  1. S DIR("A",2)="2 - Select Group(s) that Contain: XXX"
  1. S DIR("A",3)="3 - Select Group(s) in Range: XXX - YYY"
  1. S DIR("A",4)="4 - Select Group(s) that are BLANK"
  1. S DIR("?",1)="Select the type of filter to determine what Group(s) will be "
  1. S DIR("?",2)="displayed as follows:"
  1. S DIR("?",3)=" Begins with - Displays all group(s) that begin with the"
  1. S DIR("?",4)=" specified text (inclusive, case insensitive)"
  1. S DIR("?",5)=" Contains - Displays all group(s) that contain the"
  1. S DIR("?",6)=" specified text (inclusive, case insensitive)"
  1. S DIR("?",7)=" Range - Displays all group(s) within the "
  1. S DIR("?",8)=" specified range (inclusive, case insensitive)"
  1. S DIR("?")=" Blank - Displays all group(s) that are Blank or null"
  1. S XX="1:Begins with;2:Contains;3:Range;4:Blank"
  1. D ^DIR
  1. I $D(DIROUT)!$D(DIRUT)!$D(DTOUT)!$D(DUOUT) Q -1 ; No valid search selected
  1. S FILTER=Y
  1. I FILTER=4 G SELFILTQ
  1. ;
  1. ; Next ask for 'Begin with', 'Contains' or 'Range Start' text
  1. W !
  1. K DIR
  1. S DIR(0)="F^1;30"
  1. S XX=$S(FILTER=1:"that begin with",FILTER=2:"that contain",1:"Start of Range")
  1. S DIR("A")=" Select Group(s) "_XX
  1. I FILTER=1 D
  1. . S DIR("?")="Enter the text that each Group(s) will begin with"
  1. I FILTER=2 D
  1. . S DIR("?")="Enter the text that each Group(s) will contain"
  1. I FILTER=3 D
  1. . S DIR("?")="Enter the starting range text"
  1. D ^DIR K DIR
  1. I $D(DIROUT)!$D(DIRUT)!$D(DTOUT)!$D(DUOUT) Q -1 ; No valid search selected
  1. S $P(FILTER,"^",2)=Y
  1. I $P(FILTER,"^",1)'=3 G SELFILTQ
  1. ;
  1. ; Finally, ask for 'Range End' text if using a range filter
  1. W !
  1. K DIR
  1. S DIR(0)="F^1;30"
  1. S DIR("A")=" Select Group(s) End of Range"
  1. S DIR("B")=$P(FILTER,"^",2)
  1. S DIR("?")="Enter the ending Range text"
  1. D ^DIR
  1. I $D(DIROUT)!$D(DIRUT)!$D(DTOUT)!$D(DUOUT) Q -1 ; No valid search selected
  1. S $P(FILTER,"^",3)=Y
  1. SELFILTQ ;
  1. Q FILTER
  1. ;
  1. BLDSELECT ; go through selected insurances and get their groups
  1. ;
  1. N GCT,GIEN,IBINSN,IBC,IBCO,IBINS,IBP,PLANDATA,PLANOK
  1. K ^TMP($J,"IBCNOR","FND")
  1. ; user selected insurance companies
  1. I 'IBCNOR("IBIG") D
  1. . S IBINSN="",(IBQUIT,IBSTOP,IBCO)=0
  1. . F S IBINSN=$O(IBSORT(IBINSN)) Q:IBINSN="" D I IBQUIT!(IBSTOP) Q
  1. . . S IBINS=0 F S IBINS=$O(IBSORT(IBINSN,IBINS)) Q:'IBINS D I IBQUIT!(IBSTOP) Q
  1. . . . S IBC=IBSORT(IBINSN,IBINS),IBCO=IBCO+1
  1. . . . ;clear the plans before build
  1. . . . K ^TMP("IBCNOR",$J,"INS",IBC,"GRP")
  1. . . . ;
  1. . . . S IBOK=0 W !!,"Insurance Company # "_IBCO_": "_IBINSN
  1. . . . D OK^IBCNSM3
  1. . . . I IBQUIT S IBSTOP=1 Q
  1. . . . ;I 'IBOK K ^TMP("IBCNOR",$J,"INS",IBC) Q
  1. . . . I 'IBOK Q
  1. . . . W " ...building a list of plans..."
  1. . . . ; The Groups listed will be filtered the based on the users selections above
  1. . . . K ^TMP($J,"IBSEL")
  1. . . . D LKP^IBCNSU21(IBINS,1,1,IBCNOR("IBIGN"),IBCNOR("IBFIL"))
  1. . . . I IBQUIT S IBSTOP=1 Q
  1. . . . I $G(^TMP($J,"IBSEL",0))=0 D
  1. . . . . K ^TMP("IBCNOR",$J,"INS",IBC,"GRP")
  1. . . . ;
  1. . . . ; Add SELECTED Plans to ^TMP("IBCNOR")
  1. . . . I $G(^TMP($J,"IBSEL",0))>0 D
  1. . . . . S GCT=0
  1. . . . . S GIEN=0 F S GIEN=$O(^TMP($J,"IBSEL",GIEN)) Q:'GIEN D
  1. . . . . . S GCT=GCT+1
  1. . . . . . S ^TMP("IBCNOR",$J,"INS",IBC,"GRP",GCT)=GIEN
  1. . K ^TMP($J,"IBCNOR","FND") M ^TMP($J,"IBCNOR","FND")=^TMP("IBCNOR",$J,"INS")
  1. Q
  1. ;
  1. BLDINSGR ; go through insurances and get their groups
  1. ;
  1. N IBC,IBCT,GCT,GIEN,IBC,IBINS,IBP,PLANDATA,PLANOK
  1. ; user selected ALL insurance companies
  1. S IBCT=0
  1. I IBCNOR("IBIG") D
  1. . S (IBC,GCT,IBINS,IBSTOP)=0
  1. . F S IBC=$O(^TMP("IBCNOR",$J,"INS",IBC)) Q:'IBC S IBINS=$G(^TMP("IBCNOR",$J,"INS",IBC)) I IBINS D Q:IBSTOP
  1. . . S GCT=0,IBP=0
  1. . . F S IBP=$O(^IBA(355.3,"B",+IBINS,IBP)) Q:'IBP D
  1. . . . S IBCT=IBCT+1 I $G(IOST)["C-"&(IBCT#1000=0) W "."
  1. . . . K PLANDATA,PLANOK
  1. . . . D GETS^DIQ(355.3,+IBP_",",".11;2.01;2.02","EI","PLANDATA")
  1. . . . I $G(PLANDATA(355.3,IBP,.11,"I")) Q ; only get active plans
  1. . . . ;
  1. . . . S GCT=GCT+1
  1. . . . S ^TMP("IBCNOR",$J,"INS",IBC,"GRP",GCT)=IBP
  1. Q
  1. ;