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

IBJD.m

Go to the documentation of this file.
  1. IBJD ;ALB/CPM - DIAGNOSTIC MEASURES UTILITIES ; 16-DEC-96
  1. ;;2.0;INTEGRATED BILLING;**69,123**;21-MAR-94
  1. ;
  1. DS ; Print a (S)ummary or (D)etail Report?
  1. S DIR(0)="SA^S:SUMMARY;D:DETAILED;"
  1. S DIR("A")="Do you wish to print a (S)ummary or (D)etailed Report? "
  1. S DIR("?")="^D HDS^IBJD"
  1. W ! D ^DIR K DIR S IBRPT=Y
  1. Q
  1. ;
  1. SDIV() ; - Sort by division.
  1. ; Output: SDIV = 1 - Sort by Division / 0 - Do not sort by Division
  1. ; or "^" - User selected "^"
  1. ; VAUTD = 1 - All divisions selected / 0 - Specific divisions
  1. ; VAUTD(DIV) = Divsions selected
  1. ;
  1. N SDIV,DIR,J
  1. ;
  1. K DIR,VAUTD S DIR(0)="Y",DIR("B")="NO" W !
  1. S DIR("A")="Do you wish to sort this report by division"
  1. S DIR("T")=DTIME,DIR("?")="^D HDIV^IBJD"
  1. D ^DIR K DIR
  1. I $D(DIRUT)!$D(DTOUT)!$D(DUOUT)!$D(DIROUT) S SDIV="^" G QDIV
  1. S SDIV=+Y K DIROUT,DTOUT,DUOUT,DIRUT
  1. I SDIV D PSDR^IBODIV I Y<0 S SDIV="^"
  1. ;
  1. ; - Set VAUTD when ALL divisions have been selected
  1. I SDIV,VAUTD S J=0 F S J=$O(^DG(40.8,J)) Q:'J S VAUTD(J)=""
  1. ;
  1. QDIV Q SDIV
  1. ;
  1. MLTP(PRPT,OPT,ALL) ; Function for multiple value selection
  1. ; Input: PRPT - String to be prompted to the user, before listing options
  1. ; OPT - Array containing the possible entries (indexed by code)
  1. ; Obs: Code must be sequential starting with 1
  1. ; ALL - Flag indicating if the last option is ALL OF THE ABOVE
  1. ;
  1. ; Output: MLTP - User selection, i.e. "1,2,3," or "1," or 0 (nothing
  1. ; was selected)
  1. ;
  1. N A,DIR,DIRUT,DTOUT,DUOUT,DIROUT,I,IX,LST,MLTP
  1. ;
  1. PRPT S MLTP=0,ALL=+$G(ALL)
  1. S LST=$O(OPT(""),-1)
  1. S DIR(0)="LO^1:"_LST_"^K:+$P(X,""-"",2)>"_LST_" X"
  1. S DIR("A",1)=$G(PRPT),DIR("A",2)=""
  1. S A="",IX=3
  1. F S A=$O(OPT(A)) Q:A="" D
  1. . S DIR("A",IX)=" "_A_" - "_$G(OPT(A)),IX=IX+1
  1. S DIR("A",IX)="",DIR("A")="Select",DIR("B")=LST,DIR("T")=DTIME W !
  1. D ^DIR K DIR I $D(DIRUT)!$D(DTOUT)!$D(DUOUT)!$D(DIROUT) G QT
  1. S MLTP=Y K DIROUT,DTOUT,DUOUT,DIRUT
  1. ;
  1. I ALL,MLTP[LST S MLTP=LST_","
  1. ;
  1. S DIR(0)="Y",DIR("A",1)="You have selected",DIR("A",2)=""
  1. S A="",IX=3
  1. F I=1:1:($L(MLTP,",")-1) D
  1. . S DIR("A",IX)=" "_$P(MLTP,",",I)_" - "_$G(OPT($P(MLTP,",",I)))
  1. . S IX=IX+1
  1. S DIR("A",IX)=""
  1. S DIR("A")="Are you sure",DIR("B")="NO",DIR("T")=DTIME W !
  1. D ^DIR K DIR I $D(DIRUT)!$D(DTOUT)!$D(DUOUT)!$D(DIROUT) S MLTP=0 G QT
  1. K DIROUT,DTOUT,DUOUT,DIRUT I 'Y K DIR G PRPT
  1. ;
  1. I ALL,MLTP[LST D
  1. . S MLTP="" F I=(LST-1):-1:1 S MLTP=I_","_MLTP
  1. ;
  1. QT Q MLTP
  1. ;
  1. SNL() ; - Determine the sorting of the patient (By Name or Last 4 SSN)
  1. ; Output: SNL = "N" (Name)/"L" (Last 4 SSN) ^ "NAME" or "LAST 4"
  1. ;
  1. N DIR,DIRUT,DTOUT,DUOUT,DIROUT,SNL
  1. S SNL=""
  1. S DIR(0)="SA^N:NAME;L:LAST 4"
  1. S DIR("A")="Sort Patients by (N)AME or (L)AST 4 of the SSN: "
  1. S DIR("B")="NAME",DIR("T")=DTIME,DIR("?")="^D HNL^IBJD"
  1. W ! D ^DIR K DIR I Y=""!(X="^") Q "^"
  1. S SNL=Y
  1. ;
  1. Q SNL
  1. ;
  1. INTV(SORT) ; Selects the interval
  1. ; Output: First value ^ Last Value ^ "ALL"/"NULL"/""
  1. ;
  1. N ALNU,FRST,LAST,X
  1. ;
  1. S (ALNU,FRST,LAST)=""
  1. FRST W !!?3,"START WITH "_SORT_": FIRST// " R X:DTIME I '$T!(X["^") Q "^"
  1. I $E(X)="?" D HFST G FRST
  1. S FRST=X
  1. LAST W !?8,"GO TO "_SORT_": LAST// " R X:DTIME I '$T!(X["^") Q "^"
  1. I $E(X)="?" D HLST G LAST
  1. I X="" S LAST="zzzzz" S:FRST="" ALNU="ALL" G QINT
  1. I X="@",FRST="@" S LAST="@",ALNU="NULL" G QINT
  1. I FRST'="@",FRST]X D G LAST
  1. .W *7,!!?7,"The LAST value must follow the FIRST.",!
  1. S LAST=X
  1. ;
  1. QINT Q (FRST_"^"_LAST_"^"_ALNU)
  1. ;
  1. EXCEL() ; - Returns whether to catpture data for Excel report.
  1. ; Output: EXCEL = 1 - YES (capture data) / 0 - NO (DO NOT capture data)
  1. ;
  1. N EXCEL,DIR,DIRUT,DTOUT,DUOUT,DIROUT
  1. ;
  1. S DIR(0)="Y",DIR("B")="NO",DIR("T")=DTIME W !
  1. S DIR("A")="Do you want to capture report data for an Excel document"
  1. S DIR("?")="^D HEXC^IBJD"
  1. D ^DIR K DIR I $D(DIRUT)!$D(DTOUT)!$D(DUOUT)!$D(DIROUT) Q "^"
  1. K DIROUT,DTOUT,DUOUT,DIRUT
  1. S EXCEL=0 I Y S EXCEL=1
  1. ;
  1. Q EXCEL
  1. ;
  1. CLMACT(X,Y) ; - Check if AR has a corresponding claim or IB action.
  1. ; Input: X=Claim/AR pointer to file #399/#430
  1. ; Y=AR category pointer to file #430.2
  1. ; Output: Z=1-IB action, 2-Claim, 3-No IB action or claim
  1. ; ^ IB action IEN (if 1) or AR/claim IEN (if 2 or 3)
  1. ; OR null=Invalid IB action or claim
  1. N ACT,BILL,NODE,NODE1,Z S Z="" G:'$G(X)!('$G(Y)) CLACQ
  1. S BILL=$P($G(^PRCA(430,X,0)),U) G:BILL="" CLACQ
  1. ;
  1. ; - Check for most recent IB action.
  1. S ACT=+$O(^IB("ABIL",BILL,9999999),-1) G:'ACT CLAC1
  1. S NODE=$G(^IB(ACT,0)) G:NODE="" CLAC1
  1. I $P(NODE,U,5)'=3!($P(NODE,U,10)) G CLACQ ; Not billed/cancelled.
  1. I $P($G(^IBE(350.1,+$P(NODE,U,3),0)),U,3)=Y S Z=1_U_ACT G CLACQ
  1. ;
  1. CLAC1 ; - Check for IB claim.
  1. I '$D(^DGCR(399,X,0)) S Z=3_U_X G CLACQ ; No IB action/claim.
  1. S NODE=$G(^DGCR(399,X,0)) G:$P(NODE,U,13)=7 CLACQ ; Cancelled claim.
  1. S NODE1=$G(^DGCR(399.3,+$P(NODE,U,7),0)) G:NODE1="" CLACQ
  1. I '$P(NODE1,U,3),$P(NODE1,U,6)=Y S Z=2_U_X
  1. CLACQ Q Z
  1. ;
  1. ALSP(PRPT,FILE,ARR) ; Selection of (A)LL or (S)pecific values from a given file
  1. ; Input: PRPT - Piece 1: Label for the PROMPT to be asked for the
  1. ; selection (in the plural) - e.g. "Providers"
  1. ; Piece 2: Singular of piece 1 - e.g. "Provider"
  1. ; Exaple: "Specialties^Specialty"
  1. ; FILE - File global root (e.g., "^IBE(356.8," ) that the values
  1. ; will be selected from
  1. ; ARR - Name of the array that will contain the specific values
  1. ; (must be passed as a refernce value ".ARR")
  1. ; Output: ARR - "A" - ALL values OR "S" - Specific values OR "^"
  1. ; The values will be returned in the array indicated in
  1. ; ARR parameter
  1. ;
  1. N DIC,PRL,SNG,X
  1. K ARR S PRL=$P(PRPT,"^"),SNG=$P(PRPT,"^",2) S:SNG="" SNG=PRL
  1. ALSP1 W !!,"Run report for (A)LL or (S)PECIFIC "_PRL_": A// "
  1. R X:DTIME I '$T!(X["^") S ARR="^" G QALSP
  1. S X=$S(X="":"A",1:$E(X)) I "AaSs"'[X D HALSP G ALSP1
  1. W " ",$S("Ss"[X:"SPECIFIC",1:"ALL") I "Aa"[X K ARR S ARR="A" G QALSP
  1. S ARR="S"
  1. ALSP2 S DIC=FILE,DIC(0)="AEQMZ"
  1. S DIC("A")=" Select a"_$S($O(ARR(""))'="":"nother",1:"")_" "
  1. S DIC("A")=DIC("A")_SNG_": "
  1. D ^DIC K DIC I $D(DTOUT)!($D(DUOUT)) K ARR S ARR="^" G QALSP
  1. I Y'>0 G ALSP1:$O(ARR(""))="" G QALSP
  1. I $D(ARR(+Y)) D G ALSP2
  1. . W !!?3,"Already selected. Choose another "_SNG,*7,!
  1. S ARR(+Y)="" G ALSP2
  1. ;
  1. QALSP Q
  1. ;
  1. HDS ; Help for Summary/Detail prompt.
  1. W !,"Please enter 'S' for 'Summary' or 'D' for a Detailed Report."
  1. W !,"Note that if you select the Detailed report, the Summary will also print."
  1. Q
  1. ;
  1. HDIV ; - 'Sort by division...' prompt
  1. W !!," Enter: '<CR>' - To print the report without regard to division"
  1. W !!," 'Y' - To select those divisions for which a separate"
  1. W !," report should be created"
  1. W !," '^' - To quit this option"
  1. Q
  1. ;
  1. HNL ; - 'Sort Patients by (N)AME... ' prompt
  1. W !!," Enter: '<CR>' - To select and sort patients by name"
  1. W !!," 'L' - To select and sort patients by the last 4"
  1. W !," of the SSN"
  1. W !," '^' - To quit this option"
  1. Q
  1. ;
  1. HFST ; - 'START WITH PATIENT/DEBTOR...' prompt
  1. W !!," Enter a valid field value, or"
  1. W !!," '@' - To include null values"
  1. W !," '<CR>' - To start from the 'first' value for this field"
  1. W !," '^' - To quit this option"
  1. Q
  1. ;
  1. HLST ; - 'GO TO PATIENT/DEBTOR' prompt
  1. W !!," Enter a valid field value, or"
  1. W !!," '@' - To include only null values, if 'Start with'"
  1. W !," value is @"
  1. W !," '<CR>' - To go to the 'last' value for this field"
  1. W !," '^' - To quit this option",!
  1. Q
  1. ;
  1. HEXC ; - 'Do you want to capture data...' prompt
  1. W !!," Enter: 'Y' - To capture detail report data to transfer"
  1. W !," to an Excel document"
  1. W !," '<CR>' - To skip this option"
  1. W !," '^' - To quit this option"
  1. Q
  1. ;
  1. HALSP ; - 'Run report for (A)LL or (S)pecific...' prompt.
  1. W !!?6,"Enter: '<CR>' - To select all "_PRL
  1. W !?16,"'S' - To select one or more "_PRL
  1. W !?16,"'^' - To quit this option"
  1. Q
  1. ;
  1. EXMSG ; - Displays the message about capturing to an Excel file format
  1. ;
  1. W !!?5,"Before continuing, please set up your terminal to capture the"
  1. W !?5,"detail report data. On some terminals, this can be done by"
  1. W !?5,"clicking on the 'Tools' menu above, then click on 'Capture"
  1. W !?5,"Incoming Data' to save to Desktop. This report may take a"
  1. W !?5,"while to run."
  1. W !!?5,"Note: To avoid undesired wrapping of the data saved to the"
  1. W !?5," file, please enter '0;256;999' at the 'DEVICE:' prompt.",!
  1. Q
  1. ;
  1. EXPAND(FILE,FIELD,VALUE) ; Resolve coded data.
  1. N Y,C S Y=VALUE
  1. I 'FILE!('FIELD)!(VALUE="") G EXPQ
  1. S Y=VALUE,C=$P(^DD(FILE,FIELD,0),"^",2) D Y^DIQ
  1. EXPQ Q Y
  1. ;
  1. DT(X,Y) ; - Return date.
  1. ; Input: X=Date in Fileman format
  1. ; Output: Z=Date in MMM DD,YYYY format or MMDDYY format if Y=1
  1. N Z S Z="" G:'$G(X) DTQ
  1. I $G(Y) S Z=$E(X,4,7)_$E(X,2,3) G DTQ
  1. N Y S Y=X X ^DD("DD") S Z=$P(Y,"@")
  1. DTQ Q Z