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

IBTRH5E.m

Go to the documentation of this file.
  1. IBTRH5E ;ALB/FA - HCSR Create 278 Request ;12-AUG-2014
  1. ;;2.0;INTEGRATED BILLING;**517**;21-MAR-94;Build 240
  1. ;;Per VA Directive 6402, this routine should not be modified.
  1. ;;
  1. ; Contains Entry points and functions used in creating a 278 request from a
  1. ; selected entry in the HCSR Response worklist
  1. ;
  1. ; -------------------------- Entry Points --------------------------------
  1. ; SELSL - Allows the user to see a quick view of the currently entered
  1. ; Service Lines and either pick one to edit, enter a new one or
  1. ; skip.
  1. ; SELOU - Allows the user to see a quick view of the currently entered
  1. ; Other UMO Information and either pick one to edit, enter a
  1. ; new one or skip.
  1. ; SELSPD - Allows the user to see a quick view of the currently entered
  1. ; Service Line Provider Data Lines and either pick one to edit,
  1. ; enter a new one or skip.
  1. ;-----------------------------------------------------------------------------
  1. ;
  1. SELOU(IBTRIEN) ;EP
  1. ; Called from within Input template IB CREATE 278 REQUEST
  1. ; Provides the user with a quick view of currently entered Other UMO
  1. ; Information multiples and allows them to select one to edit or enter a new
  1. ; one.
  1. ; Input: IBTRIEN - IEN of the 356.22 entry being edited
  1. ; Returns: Value of the .01 field of the multiple to edit
  1. ; "" if creating a new multiple, -2 to exit template
  1. ; IBNEW=1 when creating a new entry
  1. N CNT,ENTNUM,FDA,IEN,H1,H2,L1,L2,OUDATA,OUTYPE,MAX,RETIEN,SECT,X,XX,Y,YY
  1. S IBNEW=0,SECT="Other UMO Information"
  1. ;
  1. ; First check for an empty Other UMO Information Lines to delete
  1. D DELOU(IBTRIEN)
  1. ;
  1. ; Next create an array of all current Other UMO Information lines
  1. S XX=+$P($G(^IBT(356.22,IBTRIEN,15,0)),"^",4) ; Total # of multiples
  1. S MAX=$S(XX<3:"",1:"Other UMO Information Lines")
  1. S IEN=0,CNT=0
  1. F D Q:+IEN=0
  1. . S IEN=$O(^IBT(356.22,IBTRIEN,15,IEN))
  1. . Q:+IEN=0
  1. . S CNT=CNT+1
  1. . S XX=$$LJ^XLFSTR(CNT,4) ; Selection #
  1. . S YY=$$GET1^DIQ(356.2215,IEN_","_DA_",",.01) ; UMO Type
  1. . S YY=$E(YY,1,30)_" "
  1. . S XX=XX_$$LJ^XLFSTR(YY,32)
  1. . S YY=$$GET1^DIQ(356.2215,IEN_","_DA_",",.02) ; UMO Name
  1. . S XX=XX_$$LJ^XLFSTR(YY,"44T")
  1. . S OUDATA(CNT)=IEN_"^"_XX
  1. ;
  1. ; Creating 1st Other UMO Information Line?
  1. I 'CNT D Q $S($O(RETIEN(0)):RETIEN($O(RETIEN(0))),1:XX)
  1. . W !!,"No Other UMO Information is currently on file.",!
  1. . S XX=$$ASKNEW^IBTRH5D("Add Other UMO Information","NO")
  1. . Q:XX<0
  1. . S OUTYPE=$$OUTYPE(IBTRIEN) ; Get the .01 value
  1. . I OUTYPE="" S XX=-1 Q ; None entered
  1. . S IBNEW=1,XX=OUTYPE
  1. . S FDA(356.2215,"+1,"_IBTRIEN_",",.01)=OUTYPE
  1. . D UPDATE^DIE("","FDA","RETIEN") ; File the new line
  1. ;
  1. ; Next display all of the current Other UMO Information
  1. S H1="# Type UMO Name"
  1. S H2="-- ------------------------------ ------------------------------"
  1. S L1="The following Other UMO Information is currently on file."
  1. S L2="Enter the # of an entry to edit, 'NEW' to add one or press Return to skip."
  1. S XX=$$SELENT^IBTRH5D(.OUDATA,H1,H2,L1,L2,MAX,"",SECT)
  1. I XX?1"D".N D Q -3
  1. . S (XX,ENTNUM)=$P(XX,"D",2)
  1. . S XX=$P(OUDATA(XX),U)
  1. . D DELOU(IBTRIEN,XX)
  1. . W !,"Entry #",ENTNUM," has been deleted."
  1. ;
  1. I XX<0 Q XX
  1. I XX=0 D Q $S($O(RETIEN(0)):RETIEN($O(RETIEN(0))),1:XX)
  1. . S OUTYPE=$$OUTYPE(IBTRIEN) ; Get the .01 value
  1. . I OUTYPE="" S XX=-1 Q ; None entered
  1. . S IBNEW=1
  1. . S XX=OUTYPE
  1. . S FDA(356.2215,"+1,"_IBTRIEN_",",.01)=OUTYPE
  1. . D UPDATE^DIE("","FDA","RETIEN") ; File the new line
  1. Q $P(OUDATA(XX),"^",1)
  1. ;
  1. OUTYPE(IBTRIEN) ; Prompts the user to enter the .01 (Entity Identifier) field
  1. ; of the Other UMO Information Multiple
  1. ; Input: IBTRIEN - IEN of the 356.22 entry being edited
  1. ; Returns: Selected Entity Identifier or "" of not entered
  1. N ARR,DA,DIR,DIROUT,DIRUT,DTOUT,DUOUT,EIS,ERR,IX,X,XX,YY
  1. S EIS="",IX=0
  1. F D Q:'+IX
  1. . S IX=$O(^IBT(356.22,IBTRIEN,15,IX))
  1. . Q:+IX=0
  1. . S XX=$P(^IBT(356.22,IBTRIEN,15,IX,0),"^",1)
  1. . S EIS=$S(EIS="":XX,1:EIS_"^"_XX)
  1. S DA(1)=IBTRIEN
  1. S:EIS'="" EIS="^"_EIS_"^"
  1. D FIELD^DID(356.2215,.01,,"POINTER","ARR","ERR")
  1. S DIR("A")=" Other UMO Qualifier: "
  1. S XX=""
  1. F IX=1:1:$L(ARR("POINTER"),";") D
  1. . S YY=$P(ARR("POINTER"),";",IX)
  1. . Q:EIS[("^"_$P(YY,":",1)_"^")
  1. . S XX=$S(XX="":YY,1:XX_";"_YY)
  1. S DIR(0)="SOA^"_XX
  1. D ^DIR
  1. Q:$D(DIRUT) ""
  1. Q $P(Y,"^",1)
  1. ;
  1. DELOU(IBTRIEN,IEN) ; Checks to see if the user entered 'NEW' to create a new
  1. ; Other UMO Information Line and didn't enter any data for it OR selected a
  1. ; line to be deleted. If so, the Other Information Line with no data (or'
  1. ; selected) is deleted
  1. ; Input: IBTRIEN - IEN of the 356.22 entry being edited
  1. ; IEN - Optional, IEN of the multiple to be deleted if passed
  1. ; defaults to ""
  1. ; Output: Empty or selected Other UMO Information line is deleted (Potentially)
  1. N DA,DIK,OUIEN,X,XX,Y
  1. S:'$D(IEN) IEN=""
  1. I IEN'="" D Q
  1. . S DA(1)=IBTRIEN,DA=IEN
  1. . S DIK="^IBT(356.22,DA(1),15,"
  1. . D ^DIK ; Delete the multiple
  1. ;
  1. S OUIEN=+$P($G(^IBT(356.22,IBTRIEN,15,0)),"^",3) ; Last Multiple IEN
  1. Q:'OUIEN
  1. S XX=$G(^IBT(356.22,IBTRIEN,15,OUIEN,0))
  1. S $P(XX,"^",1)="" ; Remove .01 field
  1. Q:$TR(XX,"^","")'="" ; 0 node data exists
  1. S DA(1)=IBTRIEN,DA=OUIEN
  1. S DIK="^IBT(356.22,DA(1),15,"
  1. D ^DIK ; Delete the multiple
  1. Q
  1. ;
  1. SELSL(IBTRIEN) ;EP
  1. ; Called from within Input template IB CREATE 278 REQUEST
  1. ; Provides the user with a quick view of currently entered Service Lines and
  1. ; allows them to select one to edit or enter a new Service Line.
  1. ; Input: IBTRIEN - IEN of the 356.22 entry being edited
  1. ; IBTRF - 1 - Being called from the brief form
  1. ; Returns: Value of the .01 field of the multiple to edit
  1. ; "" if creating a new multiple
  1. ; -1 if skipping altogether
  1. ; -2 to exit template
  1. ; IBNEW=1 when creating a new entry
  1. N CNT,ENTNUM,FDA,H1,H2,IEN,L1,L2,NIEN,RETIEN,SECT,SLDATA,X,XX,Y
  1. S IBNEW=0,SECT="Service Line Detail"
  1. ;
  1. ; First check for an empty Service Line to delete
  1. D DELSL(IBTRIEN)
  1. ;
  1. ; Next create an array of all current Service Lines
  1. S NIEN=+$P($G(^IBT(356.22,IBTRIEN,16,0)),"^",3)+1 ; Next Multiple IEN
  1. S IEN=0,CNT=0
  1. F D Q:+IEN=0
  1. . S IEN=$O(^IBT(356.22,IBTRIEN,16,IEN))
  1. . Q:+IEN=0
  1. . S CNT=CNT+1
  1. . S XX=$$GETSELLN(CNT,IBTRIEN,IEN,.H1,.H2) ; Format Service line for display
  1. . S SLDATA(CNT)=IEN_"^"_XX
  1. ;
  1. ; Creating 1st Service Line?
  1. I 'CNT D Q $S($O(RETIEN(0)):RETIEN($O(RETIEN(0))),1:XX)
  1. .I $G(IBTRBRF)'=1 D
  1. ..W !!,"No Service Line Detail is currently on file.",!
  1. ..S XX=$$ASKNEW^IBTRH5D("Add a new Service Line")
  1. ..Q
  1. .I $G(IBTRBRF)=1 S XX=0
  1. .Q:XX<0
  1. .S IBNEW=1,XX=NIEN
  1. .S FDA(356.2216,"+1,"_IBTRIEN_",",.01)=NIEN
  1. .D UPDATE^DIE("","FDA","RETIEN") ; File the new line
  1. .Q
  1. ;
  1. ; Next display all of the current Service Lines and let the user select one
  1. S L1="The following Service Lines are currently on file."
  1. S L2="Enter the # of a line to edit, 'NEW' to add one or press Return to skip."
  1. S XX=$$SELENT^IBTRH5D(.SLDATA,H1,H2,L1,L2,"",SECT)
  1. I XX?1"D".N D Q -3
  1. . S (XX,ENTNUM)=$P(XX,"D",2)
  1. . S XX=$P(SLDATA(XX),"^",1)
  1. . D DELSL(IBTRIEN,XX)
  1. . W !,"Entry #",ENTNUM," has been deleted."
  1. I XX<0 Q XX
  1. I XX=0 D Q $S($O(RETIEN(0)):RETIEN($O(RETIEN(0))),1:XX)
  1. . S XX=NIEN
  1. . S IBNEW=1
  1. . S FDA(356.2216,"+1,"_IBTRIEN_",",.01)=NIEN
  1. . D UPDATE^DIE("","FDA","RETIEN") ; File the new line
  1. Q $P(SLDATA(XX),"^",1)
  1. ;
  1. GETSELLN(CNT,IBTRIEN,IEN,H1,H2) ; Gets a line of information to display a
  1. ; Service Line
  1. ; Input: CNT - Current line Count
  1. ; IBTRIEN - IEN of the entry
  1. ; IEN - IEN of the Service Line
  1. ; IBTRF - 1 - Being called from the brief form
  1. ; Output: H1 - 1st Header display line
  1. ; H2 - 2nd Header display line
  1. ; Returns: Service line display
  1. N FILE,N4,XX,YY,ZZ
  1. ; IBTRBRF is defined in IB CREATE 278 REQUEST SHORT input template
  1. I $G(IBTRBRF)'=1 D
  1. . S H1="# Type Proc Code Revenue Code Units/# of Procedures"
  1. . S H2="-- ------ -------------------- ------------------- ---------------------"
  1. I $G(IBTRBRF)=1 D
  1. . S H1="# Proc Code "
  1. . S H2="-- -------------------- "
  1. S XX=$$LJ^XLFSTR(CNT,4) ; Selection #
  1. I $G(IBTRBRF)'=1 D
  1. . S YY=$$GET1^DIQ(356.2216,IEN_","_IBTRIEN_",",1.12,"I")
  1. . S YY=$S(YY="P":"Prof",YY="I":"Inst",YY="D":"Dental",1:"")
  1. . S XX=XX_$$LJ^XLFSTR(YY,6)_" "
  1. S ZZ=$$GET1^DIQ(356.2216,IEN_","_IBTRIEN_",",1.01,"I") ; Procedure Coding Method
  1. S N4=$S(ZZ="N4":1,1:0)
  1. S:'N4 YY=$$GET1^DIQ(356.2216,IEN_","_IBTRIEN_",",1.02) ; Procedure Code
  1. S:N4 YY=$$GET1^DIQ(356.2216,IEN_","_IBTRIEN_",",12.01) ; N4 Procedure Code
  1. S XX=XX_$$LJ^XLFSTR(YY,"20T")_" "
  1. I $G(IBTRBRF)'=1 D
  1. . S YY=$$GET1^DIQ(356.2216,IEN_","_IBTRIEN_",",2.06,"I") ; Revenue Code IEN
  1. . S YY=$$GET1^DIQ(399.2,YY_",",.01,"I") ; Revenue Code
  1. . S XX=XX_$$LJ^XLFSTR(YY,"20T")_" "
  1. . S YY=$$GET1^DIQ(356.2216,IEN_","_IBTRIEN_",",1.1) ; Units
  1. . S ZZ=$$GET1^DIQ(356.2216,IEN_","_IBTRIEN_",",1.11) ; Unit Count
  1. . S YY=ZZ_" "_YY
  1. . S XX=XX_$$LJ^XLFSTR(YY,"21")
  1. Q XX
  1. ;
  1. DELSL(IBTRIEN,IEN) ; Checks to see if the user entered 'NEW' to create a new
  1. ; Service Line and didn't enter any data for it OR selected a service line
  1. ; to be deleted. If so, the Service Line with no data (or selected) is deleted
  1. ; Input: IBTRIEN - IEN of the 356.22 entry being edited
  1. ; IEN - Optional, IEN of the multiple to be deleted if passed
  1. ; defaults to ""
  1. ; Output: Empty or selected Service line is deleted (Potentially)
  1. N DA,DATA,DIK,LIEN,X,XX,Y,YY
  1. S:'$D(IEN) IEN=""
  1. I IEN'="" D Q
  1. . S DA(1)=IBTRIEN,DA=IEN
  1. . S DIK="^IBT(356.22,DA(1),16,"
  1. . D ^DIK ; Delete the multiple
  1. ;
  1. S LIEN=+$P($G(^IBT(356.22,IBTRIEN,16,0)),U,3) ; Last Multiple IEN
  1. Q:'LIEN
  1. S XX=$G(^IBT(356.22,IBTRIEN,16,LIEN,0))
  1. S ($P(XX,U),$P(XX,U,11))="" ; Remove fields .01 and .11
  1. Q:$TR(XX,U,"")'="" ; 0 node data exists
  1. S XX=$G(^IBT(356.22,IBTRIEN,16,LIEN,1))
  1. S $P(XX,U,12)="" ; Remove Service Line Type
  1. S $P(XX,U)="" ; Remove Procedure Code Type
  1. Q:$TR(XX,U,"")'="" ; 1 node data exists
  1. S DATA=0
  1. F YY=2:1:9 D Q:DATA
  1. . S XX=$G(^IBT(356.22,IBTRIEN,16,LIEN,YY))
  1. . S:$TR(XX,U,"")'="" DATA=1 ; 2-9 node data exists
  1. Q:DATA
  1. S DA(1)=IBTRIEN,DA=LIEN
  1. S DIK="^IBT(356.22,DA(1),16,"
  1. D ^DIK ; Delete the line
  1. Q
  1. ;
  1. SELSPD(IBTRIEN,SIEN) ;EP
  1. ; Called from within Input template IB CREATE 278 REQUEST
  1. ; Provides the user with a quick view of currently entered Service Line
  1. ; Provider Data multiples and allows them to select one to edit or enter a
  1. ; new one.
  1. ; Input: IBTRIEN - IEN of the 356.22 entry being edited
  1. ; SIEN - Service Line Multiple IEN
  1. ; Returns: Value of the .01 field of the multiple to edit
  1. ; "" if creating a new multiple, -2 to exit multiple
  1. ; IBNEW=1 when creating a new entry
  1. N CNT,ENTNUM,FDA,H1,H2,IEN,IENS,L1,L2,MAX,PDDATA,PTYPE,RETIEN,SECT,X,XX,Y,YY
  1. S IBNEW=0,SECT="Service Provider Data Information"
  1. ;
  1. ; First check for an empty Provider Data Line to delete
  1. D DELSPD(IBTRIEN,SIEN)
  1. ;
  1. ; Next create an array of all current Service Line Provider Data Information lines
  1. S XX=+$P($G(^IBT(356.22,IBTRIEN,16,SIEN,8,0)),"^",4) ; Total # of multiples
  1. S MAX=$S(XX<10:"",1:"Provider Data Lines")
  1. S IEN=0,CNT=0
  1. F D Q:+IEN=0
  1. . S IEN=$O(^IBT(356.22,IBTRIEN,16,SIEN,8,IEN))
  1. . Q:+IEN=0
  1. . S CNT=CNT+1
  1. . S XX=" "_$$LJ^XLFSTR(CNT,4) ; Selection #
  1. . S IENS=IEN_","_SIEN_","_IBTRIEN_","
  1. . S YY=$$GET1^DIQ(356.22168,IENS,.01) ; Prov Type Desc
  1. . S XX=XX_$$LJ^XLFSTR(YY,"32T")
  1. . S YY=$$GET1^DIQ(356.22168,IENS,.02) ; Person/Non-Person
  1. . S XX=XX_$$LJ^XLFSTR(YY,12)
  1. . S YY=$$GET1^DIQ(356.22168,IENS,.03) ; Provider Name
  1. . S XX=XX_$$LJ^XLFSTR(YY,"30T")
  1. . S PDDATA(CNT)=IEN_"^"_XX
  1. ;
  1. I 'CNT D Q $S($O(RETIEN(0)):RETIEN($O(RETIEN(0))),1:XX)
  1. . W !!," No Service Provider Data is currently on file.",!
  1. . S XX=$$ASKNEW^IBTRH5D(" Add Service Provider Data Information","NO")
  1. . Q:XX<0
  1. . S PTYPE=$$PTYPE(IBTRIEN,SIEN) ; Get the .01 value
  1. . I PTYPE="" S XX=-1 Q ; None entered
  1. . S IBNEW=1,XX=PTYPE
  1. . S FDA(356.22168,"+1,"_SIEN_","_IBTRIEN_",",.01)=PTYPE
  1. . D UPDATE^DIE("","FDA","RETIEN") ; File the new line
  1. ;
  1. ; Next display all of the current Service Line Provider Data lines
  1. S H1=" # Provider Type Per/Non Provider"
  1. S H2=" -- ------------------------------ ---------- ------------------------------"
  1. S L1=" The following Provider Data Information is currently on file."
  1. S L2=" Enter the # of an entry to edit, 'NEW' to add one or press Return to skip."
  1. S XX=$$SELENT^IBTRH5D(.PDDATA,H1,H2,L1,L2,MAX,1,SECT)
  1. I XX?1"D".N D Q -3
  1. . S (XX,ENTNUM)=$P(XX,"D",2)
  1. . S XX=$P(PDDATA(XX),"^",1)
  1. . D DELSPD(IBTRIEN,SIEN,XX)
  1. . W !,"Entry #",ENTNUM," has been deleted."
  1. I XX<0 Q XX
  1. I XX=0 D Q $S($O(RETIEN(0)):RETIEN($O(RETIEN(0))),1:XX)
  1. . S PTYPE=$$PTYPE(IBTRIEN,SIEN) ; Get the .01 value
  1. . I PTYPE="" S XX=-1 Q ; None entered
  1. . S XX=PTYPE
  1. . S IBNEW=1
  1. . ;
  1. . ; NOTE: the code below had "+1," which doesn't work, don't change back
  1. . S FDA(356.22168,"+2,"_SIEN_","_IBTRIEN_",",.01)=PTYPE
  1. . D UPDATE^DIE("","FDA","RETIEN") ; File the new line
  1. Q $P(PDDATA(XX),"^",1)
  1. ;
  1. DELSPD(IBTRIEN,SIEN,IEN) ; Checks to see if the user entered 'NEW' to create a new
  1. ; Service Provider Data Line and didn't enter any data for it or selected a line
  1. ; to delete . If so, the Service Provider Data line with no data (or selectd) is deleted
  1. ; Input: IBTRIEN - IEN of the 356.22 entry being edited
  1. ; SIEN - IEN of the Service Line
  1. ; IEN - Optional, IEN of the multiple to be deleted if passed
  1. ; defaults to ""
  1. ; Output: Empty OR selected Service Provider Data Line is deleted (Potentially)
  1. N PDIEN,DA,DIK,X,XX,Y
  1. S:'$D(IEN) IEN=""
  1. I IEN'="" D Q
  1. . S DA(2)=IBTRIEN,DA(1)=SIEN,DA=IEN
  1. . S DIK="^IBT(356.22,DA(2),16,DA(1),8,"
  1. . D ^DIK ; Delete the multiple
  1. S PDIEN=+$P($G(^IBT(356.22,IBTRIEN,16,SIEN,8,0)),"^",3) ; Last Multiple IEN
  1. Q:'PDIEN
  1. S XX=$G(^IBT(356.22,IBTRIEN,16,SIEN,8,PDIEN,0))
  1. S $P(XX,"^",1)="" ; Remove .01 field
  1. Q:$TR(XX,"^","")'="" ; 0 node data exists
  1. S DA(2)=IBTRIEN,DA(1)=SIEN,DA=PDIEN
  1. S DIK="^IBT(356.22,DA(2),16,DA(1),8,"
  1. D ^DIK ; Delete the multiple
  1. Q
  1. ;
  1. PTYPE(IBTRIEN,SIEN) ; Prompts the user to enter the .01 (Provider Type) field
  1. ; of the Provider Data multiple
  1. ; Input: IBTRIEN - IEN of the 356.22 entry being edited
  1. ; SIEN - IEN of the Service Line
  1. ; Returns: IEN of the selected Provider Type or "" of not entered
  1. N DA,DIR,DIROUT,DIRUT,DTOUT,DUOUT,X,Y
  1. S DA(1)=IBTRIEN
  1. S DIR(0)="356.22168,.01",DIR("A")=" Provider Type"
  1. D ^DIR
  1. Q:$D(DIRUT) ""
  1. Q $P(Y,"^",1)
  1. ;