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

BGOVTC.m

Go to the documentation of this file.
BGOVTC ; IHS/BAO/TMD - Manage V TRANSACTION CODES ;20-Mar-2007 13:52;DKM
 ;;1.1;BGO COMPONENTS;**1,3**;Mar 20, 2007
 ; Get transaction code entry
GETTC(RET,TCIEN) ;EP
 N IENS,X
 K RET
 I '$D(^BCMTCF(TCIEN,0)) S RET(0)=$$ERR^BGOUTL(1100) Q
 S IENS=TCIEN_","
 D GETS^DIQ(90092.02,IENS,".01;.05;.06;.07;.09;1103","IE","RET")
 S IENS=+^BCMTCF(TCIEN,0)_","
 D GETS^DIQ(90092.01,IENS,".05;1102;1103;1104","IE","RET")
 S X=$G(RET(90092.01,IENS,.05,"I"))
 S:X RET(90092.01,IENS,.05,"E")=$P($G(^BCMSCC(X,0)),U,2)
 S X=$G(RET(90092.01,IENS,1102,"I"))
 S:X RET(90092.01,IENS,1102,"E")=$P($G(^ICPT(X,0)),U,2)
 S X=$G(RET(90092.01,IENS,1103,"I"))
 S:X RET(90092.01,IENS,1103,"E")=$P($G(^AUTTCMOD(X,0)),U,2)
 Q
 ; Get transaction code info for a single entry or for a visit
 ;  INP = Patient IEN [1] ^ V File IEN [2] ^ Visit IEN [3]
GET(RET,INP) ;EP
 D VFGET^BGOUTL2(.RET,INP,$$FNUM,".01;.02;.03;.04;.05;.06;.07;.09;.11;.12;.13;1201;1204")
 Q
 ; Add/edit V Transaction Code
 ; INP = V File IEN [1] ^ TC IEN [2] ^ Visit IEN [3] ^ Patient IEN [4] ^ No dups [5]
SET(RET,INP) ;EP
 N VIEN,VFIEN,VFNEW,TYPE,DFN,DUPS,TCA,MOD,FDA,FNUM,SVRCLS,CAN,NARR,DEPT
 N CHRG,MODCODE,REVCD,X,Y
 S RET="",FNUM=$$FNUM
 S VFIEN=+INP
 S VFNEW='VFIEN
 S TYPE=+$P(INP,U,2)
 S VIEN=+$P(INP,U,3)
 S DFN=+$P(INP,U,4)
 S DUPS='$P(INP,U,5)
 S RET=$$CHKVISIT^BGOUTL(VIEN,DFN)
 Q:RET
 I 'TYPE S RET=$$ERR^BGOUTL(1099) Q
 S X=$G(^BCMTCF(TYPE,0)),Y=$G(^(11))
 I '$L(X) S RET=$$ERR^BGOUTL(1100) Q
 I $P(X,U,4) S RET=$$ERR^BGOUTL(1101) Q
 S TCA=$P(X,U),CAN=$P(X,U,5),SVRCLS=$P(X,U,6),NARR=$P(X,U,7),DEPT=$P(X,U,9),CHRG=$P(Y,U,3)
 S X=$G(^BCMTCA(TCA,0)),Y=$G(^(11))
 S SVRCLS=$P(X,U,5),CPT=$P(Y,U,2),MODCODE=$P(Y,U,3),REVCD=$P(Y,U,4)
 S MOD=$S($L(MODCODE):$O(^AUTTCMOD("B",MODCODE,0)),1:"")
 I 'VFIEN D  Q:'VFIEN
 .D VFNEW^BGOUTL2(.RET,FNUM,TYPE,VIEN,$S('DUPS:"Transaction code",1:""))
 .S:RET>0 VFIEN=RET,RET=""
 S FDA=$NA(FDA(FNUM,VFIEN_","))
 S @FDA@(.01)="`"_TYPE
 S @FDA@(.04)=$S(CAN:"`"_CAN,1:"")
 S @FDA@(.05)=$S(SVRCLS:"`"_SVRCLS,1:"")
 S @FDA@(.06)=CHRG
 S @FDA@(.08)=MODCODE
 S @FDA@(.11)=NARR
 S @FDA@(.12)=$S(MOD:"`"_MOD,1:"")
 S @FDA@(.13)=$S(DEPT:"`"_DEPT,1:"")
 S @FDA@(1201)="N"
 S @FDA@(1204)="`"_DUZ
 S RET=$$UPDATE^BGOUTL(.FDA,"E")
 I RET,VFNEW,$$DELETE^BGOUTL(FNUM,VFIEN)
 D:'RET VFEVT^BGOUTL2(FNUM,VFIEN,'VFNEW)
 S:'RET RET=VFIEN
 Q
 ; Delete a V Transaction Code entry
DEL(RET,VFIEN) ;EP
 D VFDEL^BGOUTL2(.RET,$$FNUM,VFIEN)
 Q
 ; Retrieve CM list
CMLKUP(RET,INP) ;EP
 N IEN,FLD,CNT,TRNCODE,CPT
 S RET=$$TMPGBL^BGOUTL
 S TRNCODE=$P(INP,U,2),CPT=""
 S:TRNCODE?5.6N CPT=TRNCODE,TRNCODE=""
 I TRNCODE'?8N,TRNCODE'="" D  Q
 .D FIND^DIC(90092.02,,"@;.01;.07;.05;.06","P",TRNCODE,"","","","",RET)
 .K @RET@("DILIST",0)
 S CNT=0
 I TRNCODE D
 .S IEN=0
 .F  S IEN=$O(^BCMTCF("B",TRNCODE,IEN)) Q:'IEN  D CM1
 E  I CPT D
 .S TRNCODE=0
 .F  S TRNCODE=$O(^BCMTCA("C",CPT,TRNCODE)) Q:'TRNCODE  D
 ..S IEN=0
 ..F  S IEN=$O(^BCMTCF("B",TRNCODE,IEN)) Q:'IEN  D CM1
 E  D
 .S IEN=0
 .F  S IEN=$O(^BCMTCF(IEN)) Q:'IEN  D CM1
 Q
CM1 N X
 S X=$G(^BCMTCF(IEN,0))
 Q:'$L(X)
 Q:$P(X,U,4)
 S CNT=CNT+1,@RET@(CNT)=IEN_U_$P(X,U)_U_$P(X,U,7)_U_$$EXTERNAL^DILFD(90092.02,.05,,$P(X,U,5))_U_$$EXTERNAL^DILFD(90092.02,.06,,$P(X,U,6))
 Q
 ; Return V File #
FNUM() Q 9000010.33