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

DGBTID.m

Go to the documentation of this file.
DGBTID ;ALB/MRY - LOCAL VENDOR IDENTIFIER DATA ;4/23/03  09:11 AM
 ;;1.0;Beneficiary Travel;**2**;September 25, 2001
START ;DISPLAY IDENTIFYING DATA FROM RECORD IN FILE 392.31
 N LN0,LN1,LN2,LN3,PHONE,PH,A,T,T1,NO,ADDR1,CITY,STATE
 N ZIP,ADDR2,FAX,IEN
 ;
 ;GET CURRENT RECORD NODES NEEDED TO DISPLAY IDENTIFIERS
 ;
 S IEN=+Y
 S LN0=$G(^DGBT(392.31,IEN,0))
 S LN1=$G(^DGBT(392.31,IEN,1))
 S LN2=$G(^DGBT(392.31,IEN,2))
 S LN3=$G(^DGBT(392.31,IEN,3))
 ;
 ;DISPLAY ADDRESS DATA IN IDENTIFIERS
 ;
 S ADDR1="ADD:"_$P(LN1,U)
 D EN^DDIOL(ADDR1,"","!")
 ;
 ;DISPLAY DATA (BYPASS PHONE) IF VENDOR IS INACTIVATED.
 ;
 I $P(LN3,U,2)'="" G IEN
 ;
 ;DISPLAY DATA IN IDENTIFIERS IF VENDOR IN NOT INACTIVATED
 ;
 S PHONE="PH:"
 S PH=$P(LN0,U,6) I $P(LN0,U,5) S PH=$P(LN0,U,5)_" "_PH
 D PHONE
 S PHONE=PHONE_PH
 D EN^DDIOL(PHONE,"","?54")
 ;
 ;COME HERE TO DISPLAY THE RECORD'S INTERNAL ENTRY NUMBER
 ;
IEN S NO="      "_IEN
 S NO="NO:"_$E(NO,$L(NO)-5,99)
 D EN^DDIOL(NO,"","?71")
 ;
 ;NOW DISPLAY SECOND ADDRESS LINE IN IDENTIFIERS
 ;
 S CITY=$P(LN2,U)
 S STATE=$P(LN2,U,2)
 I STATE>0 D
 .  S STATE=$P($G(^DIC(5,STATE,0)),U,2)
 S ZIP=$P(LN2,U,3)
 I ZIP?9N S ZIP=$E(ZIP,1,5)_"-"_$E(ZIP,6,9)
 S ADDR2=""
 I CITY]"",STATE]"" S ADDR2=ADDR2_CITY_", "_STATE
 I CITY="",STATE]"" S ADDR2=ADDR2_STATE
 I CITY]"",STATE="" S ADDR2=ADDR2_CITY
 S:ADDR2]"" ADDR2=ADDR2_" "_ZIP
 S:ADDR2="" ADDR2=ADDR2_ZIP
 D EN^DDIOL(ADDR2,"","!?8")
 ;
 S FAX="FAX:"
 K PH
 S PH=$P(LN0,U,8) I $P(LN0,U,7) S PH=$P(LN0,U,7)_" "_PH
 D PHONE
 S FAX=FAX_PH
 D EN^DDIOL(FAX,"","?64")
 ;
 ;END OF ADDRESS LINES
 ;
 ;LETS INFORM USER IF THIS VENDOR IS INACTIVATED
 ;
 D EN^DDIOL("","","!")
 I $P(LN3,U,2)'="" D
 . D EN^DDIOL("****THIS VENDOR IS INACTIVE","","?0")
 ;
 Q
 ;
PHONE ;PHONE/FAX FORMATTING
 ;
 S PH=$TR(PH,"abcdefghijklmnoprstuvwxy","222333444555666777888999")
 S PH=$TR(PH,"ABCDEFGHIJKLMNOPRSTUVWXY","222333444555666777888999")
 I PH]"" D
 .  I PH'?.N D  Q
 .  .  S A=1
 .  .  F  S T=$E(PH,1) D:T?1N  S:T'?1N PH=$E(PH,2,99) Q:PH=""
 .  .  .  S PH(A)=""
 .  .  .  F  S T1=$E(PH,1) Q:T1'?1N  S PH(A)=PH(A)_T1,PH=$E(PH,2,99) Q:PH=""
 .  .  .  Q:PH=""
 .  .  .  S A=A+1
 .  .  .  Q
 .  .  I $G(PH(1))="011" S PH="INTERN'L" Q
 .  .  I $L($G(PH(1)))=1,$L($G(PH(2)))=3,$L($G(PH(3)))=3,$L($G(PH(4)))=4 S PH=PH(2)_"-"_PH(3)_"-"_PH(4) Q
 .  .  I $L($G(PH(1)))=3,$L($G(PH(2)))=3,$L($G(PH(3)))=4 S PH=PH(1)_" "_PH(2)_"-"_PH(3) Q
 .  .  I $L($G(PH(1)))=3,$L($G(PH(2)))=4 S PH="    "_PH(1)_"-"_PH(2) Q
 .  .  I $L($G(PH(1)))=3,$L($G(PH(2)))=7 S PH=PH(1)_" "_$E(PH(2),1,3)_"-"_$E(PH(2),4,7)
 .  .  Q
 .  I $L(PH)>9 S PH=$E(PH,1,3)_" "_$E(PH,4,6)_"-"_$E(PH,7,10) Q
 .  I $L(PH)>6 S PH="    "_$E(PH,1,3)_"-"_$E(PH,4,7) Q
 .  Q
 Q