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

BPCRC7.m

Go to the documentation of this file.
BPCRC7 ; IHS/OIT/MJL - REFERRED CARE GUI RPC ROUTINES ;
 ;;1.5;BPC;;MAY 26, 2005
GETTEMP(BPCRES,BPCRIEN,BPCPARAM) ;EP CALL FROM REMOTE PROC: BPC GETREFERRALDEF
 ;
EN1 ;
 S U="^",XWBWRAP=1,BPCCTR=0,BPCRIEN=$G(BPCRIEN),BPCPARAM=$G(BPCPARAM)
 S BPCS1="`"
 K BPCRES,BPCTMP
 I BPCRIEN="" S BPCRES(1)=-1,BPCRES(2)="TEMPLATE IEN NOT SENT!" Q
 S BPCDTA=$G(^BMCRTNRF(BPCRIEN,0)) I BPCDTA="" S BPCRES(1)=-1,BPCRES(2)="NO DATA AVAILABLE FOR TEMPLATE IEN: "_BPCRIEN Q
 D GETTEMP1,KILL
 Q
GETTEMP1 ;
 S BPCRTYP=$P(BPCDTA,U,4),BPCFAC=$P(BPCDTA,U,5),BPCPROV=$P(BPCDTA,U,6),BPCPVEND=$P(BPCDTA,U,7),BPCTOIHS=$P(BPCDTA,U,8)
 S BPCTOPRV=$P(BPCDTA,U,9),BPCPAYOR=$P(BPCDTA,U,11),BPCICD=$P(BPCDTA,U,12),BPCCPT=$P(BPCDTA,U,13),BPCPTYP=$P(BPCDTA,U,14),BPCDRG=$P(BPCDTA,U,21),BPCFDRG=$P(BPCDTA,U,21)
 S BPCPRIOR=$P(BPCDTA,U,32)
 S BPCDTA=$G(^BMCRTNRF(BPCRIEN,11)),BPCECOST=$P(BPCDTA,U,1),BPCICOST=$P(BPCDTA,U,3),BPCLOS=$P(BPCDTA,U,9),BPCNOVS=$P(BPCDTA,U,11)
 S BPCPURP=$G(^BMCRTNRF(BPCRIEN,12)),BPCSNOTE=$G(^BMCRTNRF(BPCRIEN,13))
 S BPCSFAC="" I BPCFAC'="" S BPCSFAC=+$G(^AUTTLOC(BPCFAC,0)) S:BPCSFAC BPCSFAC=$P($G(^DIC(4,BPCSFAC,0)),U,1)
 S BPCSPROV="" I BPCPROV'="" S BPCSPROV=$P($G(^VA(200,BPCPROV,0)),U,1)
 S BPCSPVND="" I BPCPVEND'="" S BPCSPVND=$P($G(^AUTTVNDR(BPCPVEND,0)),U,1)
 S BPCSIHS="" I BPCTOIHS'="" S BPCSIHS=$P($G(^AUTTLOC(BPCTOIHS,0)),U,1) S:BPCSIHS'="" BPCSIHS=$P($G(^DIC(4,BPCSIHS,0)),U,1)
 S BPCSTPRV="" I BPCTOPRV'="" S BPCSTPRV=$P($G(^BMCLPRV(BPCTOPRV,0)),U,1)
 S BPCSICD="" I BPCICD'="" S BPCSICD=$P($G(^BMCTDXC(BPCICD,0)),U,1)
 S BPCSCPT="" I BPCCPT'="" S BPCSCPT=$P($G(^BMCTSVC(BPCCPT,0)),U,1)
 S BPCSDRG="" I BPCDRG'="" S BPCSDRG=$P($G(^ICD(BPCDRG,0)),U,1)
 S BPCSFDRG="" I BPCFDRG'="" S BPCSFDRG=$P($G(^ICD(BPCFDRG,0)),U,1)
 S BPCTMP("DATA",0)="DATA"_BPCS1_BPCRTYP_BPCS1_BPCFAC_BPCS1_BPCSFAC_BPCS1_BPCPROV_BPCS1_BPCSPROV_BPCS1_BPCPVEND_BPCS1_BPCSPVND_BPCS1_BPCTOIHS_BPCS1_BPCSIHS
 S BPCTMP("DATA",0)=BPCTMP("DATA",0)_BPCS1_BPCTOPRV_BPCS1_BPCSTPRV_BPCS1_BPCPAYOR_BPCS1_BPCICD_BPCS1_BPCSICD_BPCS1_BPCCPT_BPCS1_BPCSCPT_BPCS1_BPCPTYP
 S BPCTMP("DATA",0)=BPCTMP("DATA",0)_BPCS1_BPCDRG_BPCS1_BPCSDRG
 S BPCTMP("DATA",0)=BPCTMP("DATA",0)_BPCS1_BPCFDRG_BPCS1_BPCSFDRG_BPCS1_BPCPRIOR_BPCS1_BPCECOST_BPCS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,BPCPARAM,BPCN,BPCFLAG,BPCIEN,BPCCTR
 Q
TEMPLIST(BPCRES,BPCX,BPCMAX,BPCMORE,BPCPARAM) ;EP CALL FROM REMOTE PROC: BPC GETTEMPLATELIST 
 ;
 S BPCGUI=1
EN ;
 S U="^",XWBWRAP=1,BPCCTR=0,BPCSUB=$J,BPCC="",BPCMORE=$G(BPCMORE),BPCGUI=$G(BPCGUI),BPCMAX=$G(BPCMAX),BPCX=$G(BPCX),BPCPARAM=$G(BPCPARAM),BPCLEN=$L(BPCX)
 S BPCRES="^BPCRES("_BPCSUB_")",BPCN=""
 S:'BPCMAX BPCMAX=$S(BPCGUI:50,1:1E10) ;
 K ^BPCRES(BPCSUB)
 S:BPCX'="" BPCN=$O(^BMCRTNRF("B",BPCX),-1)
 I BPCMORE'="" D MORE,KILL Q
 D GETTMP1,KILL
 Q
GETTMP1 ;
 S BPCFLAG=0 F  S BPCN=$O(^BMCRTNRF("B",BPCN)) Q:BPCN=""  D GETTMP2 Q:BPCFLAG
 S ^BPCRES(BPCSUB,0)=BPCCTR
 Q
GETTMP2 ;
 I BPCX'="",$E(BPCN,1,BPCLEN)'=BPCX S BPCFLAG=1 Q
 S BPCIEN="" F  S BPCIEN=$O(^BMCRTNRF("B",BPCN,BPCIEN)) Q:BPCIEN=""  D SETRES Q:BPCFLAG
 Q
SETRES ;
 I BPCCTR=BPCMAX D SETMORE S BPCFLAG=1 Q
 S BPCCTR=BPCCTR+1,^BPCRES(BPCSUB,BPCCTR)=BPCN_U_BPCIEN
 Q
SETMORE ;
 S BPCCTR=BPCCTR+1,^BPCRES(BPCSUB,BPCCTR)="..MORE"_U_BPCN_"|"_BPCIEN
 Q
MORE ;
 S BPCFLAG=0,BPCN=$P(BPCMORE,"|",1),BPCIEN=$P(BPCMORE,"|",2) D SETRES Q:BPCFLAG
 F  S BPCIEN=$O(^BMCRTNRF("B",BPCN,BPCIEN)) Q:BPCIEN=""  D SETRES Q:BPCFLAG
 Q:BPCFLAG
 D GETTMP1
 Q