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

BGPGU.m

Go to the documentation of this file.
BGPGU ; IHS/CMI/LAB - BGP Gui Utilities 10/29/2004 3:28:39 PM ;
 ;;11.1;IHS CLINICAL REPORTING SYSTEM;;JUN 27, 2011;Build 33
 ;
 ;
DEBUG(RETVAL,BGPSTR) ;run the debugger
 D DEBUG^%Serenji("SITE^BGPGU(.RETVAL,.BGPSTR)")
 Q
 ;
KEYS(RETVAL,BGPSTR) ;-- return keys for user
 S X="MERR^BGPGU",@^%ZOSF("TRAP") ; m error trap
 N BGPDA,BGPNS,P,BGPDATA,BGPKEYI,BGPKEY,BGPI
 S BGPI=0
 K ^BGPTMP($J)
 S RETVAL="^BGPTMP("_$J_")"
 S ^BGPTMP($J,BGPI)="T00030KEYS"_$C(30)
 S P="|"
 S BGPNS=$P(BGPSTR,P)
 S BGPDA=0 F  S BGPDA=$O(^VA(200,DUZ,51,BGPDA)) Q:'BGPDA  D
 . S BGPDATA=$G(^VA(200,DUZ,51,BGPDA,0))
 . S BGPKEYI=$P(BGPDATA,U)
 . S BGPKEY=$P($G(^DIC(19.1,BGPKEYI,0)),U)
 . I BGPNS'="*" Q:$E(BGPKEY,1,$L(BGPNS))'[BGPNS
 . S BGPI=BGPI+1
 . S ^BGPTMP($J,BGPI)=BGPKEY_$C(30)
 S ^BGPTMP($J,BGPI+1)=$C(31)_$G(BGPERR)
 Q
 ;
SP(RETVAL,BGPSTR) ;-- get the site parameter entry
 N BGPDA,BGPI,P
 S P="|"
 S BGPSE=$P(BGPSTR,P)
 I BGPSE="" S BGPSE=DUZ(2)
 I BGPSE'?.N S BGPSE=$O(^DIC(4,"B",BGPSE,0))
 K ^BGPTMP($J)
 S RETVAL="^BGPTMP("_$J_")"
 S BGPI=0
 S ^BGPTMP($J,BGPI)="T00010BMXIEN^T00050Location^T00050Home Location^T00050Community Taxonomy^T00001EISS^T00001CHS^T00001HeightWeight^T00050Location Taxonomy^T00050Demo Template^T00001Outreach^T00040ExportDirectory"_$C(30)
 S BGPDA=0 F  S BGPDA=$O(^BGPSITE("B",BGPSE,BGPDA)) Q:'BGPDA  D
 . N BGPDATA,BGPLI,BGPL,BGPLA,BGPHI,BGPH,BGPHA,BGPTX,BGPTXI,BGPEISS,BGPCHS,BGPMTAX,BGPMTAXI,BGPHTWT,BGPDEMOI,BGPDEMO,BGPOUT,BGPEDIR
 . S BGPDATA=$G(^BGPSITE(BGPDA,0))
 . S BGPLI=$P(BGPDATA,U)
 . S BGPL=$P($G(^DIC(4,BGPLI,0)),U)
 . S BGPLA=$P($G(^AUTTLOC(BGPLI,0)),U,10)
 . S BGPHI=$P(BGPDATA,U,2)
 . S BGPH=$S($G(BGPHI):$P($G(^DIC(4,BGPHI,0)),U),1:"")
 . S BGPHA=$S($G(BGPHI):$P($G(^AUTTLOC(BGPHI,0)),U,10),1:"")
 . S BGPTXI=$P(BGPDATA,U,5)
 . S BGPTX=$S($P(BGPDATA,U,5):$P($G(^ATXAX($P(BGPDATA,U,5),0)),U),1:"")
 . S BGPEISS=$S($P(BGPDATA,U,8):1,1:0)
 . S BGPCHS=$P(BGPDATA,U,6)
 . S BGPHTWT=$P(BGPDATA,U,11)  ;cmi/anch/maw v7.0
 . S BGPMTAXI=$P(BGPDATA,U,9)
 . S BGPMTAX=$S($P(BGPDATA,U,9):$P($G(^ATXAX($P(BGPDATA,U,9),0)),U),1:"")
 . S BGPDEMOI=$P(BGPDATA,U,12)
 . S BGPDEMO=$S(BGPDEMOI]"":$P($G(^DIBT(BGPDEMOI,0)),U),1:"")
 . S BGPOUT=$P(BGPDATA,U,13)
 . S BGPEDIR=$P(BGPDATA,U,14)
 . S BGPI=BGPI+1
 . S ^BGPTMP($J,BGPI)=BGPDA_U_$S($G(BGPLI):BGPLI_"~"_BGPL,1:"")_U_$S($G(BGPHI):BGPHI_"~"_BGPH,1:"")_U_$S($G(BGPTXI):BGPTXI_"~"_$G(BGPTX),1:"")_U_$G(BGPEISS)_U_$G(BGPCHS)_U_$G(BGPHTWT)_U_$S($G(BGPMTAXI):BGPMTAXI_"~"_$G(BGPMTAX),1:"")
 . S ^BGPTMP($J,BGPI)=^BGPTMP($J,BGPI)_U_$S($G(BGPDEMOI):BGPDEMOI_"~"_$G(BGPDEMO),1:"")_U_BGPOUT_U_BGPEDIR_$C(30)
 S ^BGPTMP($J,BGPI+1)=$C(31)_$G(BGPERR)
 Q
 ;
TAXCHK(RETVAL,BGPSTR) ;-- check taxonomies for National GPRA Report
 S X="MERR^BGPGU",@^%ZOSF("TRAP") ; m error trap
 N BGPI,BGPJ,BGPDATA,BGPDA,BGPRTN,P
 S P="|"
 S BGPI=0
 S BGPERR=""
 S BGPRTN=$P(BGPSTR,P)
 S BGPCALL=$P(BGPSTR,P,2)
 I BGPCALL="GPU" S (BGP8GPU,BGP9GPU)=1
 K ^BGPTMP($J)
 S RETVAL="^BGPTMP("_$J_")"
 S ^BGPTMP($J,BGPI)="T00250DATA"_$C(30)
 S BGPJ=0
 S IOM=80
 D GUIR^XBLM("GUICHK^"_BGPRTN,"^XTMP(""BGPTAX"",$J)")
 S BGPDA=.5 F  S BGPDA=$O(^XTMP("BGPTAX",$J,BGPDA)) Q:'BGPDA  D
 . N BGPDATA
 . S BGPI=BGPI+1
 . S BGPDATA=$G(^XTMP("BGPTAX",$J,BGPDA))
 . S ^BGPTMP($J,BGPI)=BGPDATA_$C(30)
 S ^BGPTMP($J,BGPI+1)=$C(31)_BGPERR
 K ^XTMP("BGPTAX",$J)
 K BGP8GPU,BGP9GPU
 Q
 ;
CATSTR(BGPSRET,STR) ;-- concatenate a long string in
 N BGPDA
 S BGPSRET=""
 S BGPDA=0 F  S BGPDA=$O(STR(BGPDA)) Q:'BGPDA  D
 . S BGPSRET=BGPSRET_$G(STR(BGPDA))
 Q
 ;
MERR ; MUMPS ERROR TRAP
 N BGPX
 X ("S BGPX=$"_"ZE")
 S BGPX="MUMPS error: """_BGPX_""""
 D ^%ZTER
 D ERR(BGPX)
 Q
 ;
ERR(ERR) ; BMX ADO SCHEMA ERROR PROCESSOR
 N BGPXA
 S BGPXA="ERROR|"_ERR_$C(30)
 S @RETVAL@(1)=BGPXA
 Q
 ;
FAC(RETVAL,BGPSTR) ;-- return facilities based on parameters passed
 S X="MERR^BGPGU",@^%ZOSF("TRAP") ; m error trap
 N BGPI,BGPJ,BGPDATA,BGPDA,P,BGPERR,BGPCT,BGPYN,BGPOT,BGPOPT,BGPRT
 N BGPQTR,BGPRE,BGPBAS,BGPBEN,BGPFAC
 S P="|"
 S BGPI=0
 S BGPERR=""
 S BGPRT=$P(BGPSTR,P)
 S BGPPER=$P(BGPSTR,P,2)
 S BGPQTR=$P(BGPSTR,P,3)
 S BGPBAS=$P(BGPSTR,P,4)
 S BGPBEN=$P(BGPSTR,P,5)
 K ^BGPTMP($J)
 S RETVAL="^BGPTMP("_$J_")"
 S ^BGPTMP($J,BGPI)="T00007BMXIEN^T00030Service Unit^T00030Facility^T00020Begin Date^T00020End Date^T00020Base Beg^T00020Base End^T00020Date Run"_$C(30)
 D GET^BGP5ASL(.BGPFAC,.BGPFILE,BGPRT,BGPPER,BGPQTR,BGPBAS,BGPBEN)
 N BGPDA  S BGPDA=0 F  S BGPDA=$O(BGPFAC(BGPDA)) Q:'BGPDA  D
 . S BGPI=BGPI+1
 . S ^BGPTMP($J,BGPI)=BGPDA_U_$G(BGPFAC(BGPDA))_$C(30)
 S ^BGPTMP($J,BGPI+1)=$C(31)_BGPERR
 D EN^XBVK("BGP")
 Q
 ;
SITE(RETVAL,BGPSTR) ;-- save the site parameters
 S X="MERR^BGPGU",@^%ZOSF("TRAP") ; m error trap
 N BGPI,BGPJ,BGPDATA,BGPDA,BGPHTWT,P,BGPERR,BGPFAC,BGPTAX,BGPHLOC,R,BGPEISS,BGPCHS,BGPDEMO,BGPOUT,BGPEDIR
 S P="|",R="~"
 S BGPI=0
 S BGPERR=""
 S BGPFAC=$P($P(BGPSTR,P),R)
 I BGPFAC="" S BGPFAC="@"  ;8.0 p2
 S BGPTAX=$P($P(BGPSTR,P,2),R)
 I BGPTAX="" S BGPTAX="@"  ;8.0 p2
 S BGPHLOC=$P($P(BGPSTR,P,3),R)
 I BGPHLOC="" S BGPHLOC="@"  ;8.0 p2
 I BGPHLOC]"" S BGPHLOCI=$O(^AUTTLOC("B",BGPHLOC,0))
 S BGPEISS=$P(BGPSTR,P,4)
 S BGPCHS=$P(BGPSTR,P,5)
 S BGPHTWT=$P(BGPSTR,P,6)  ;cmi/anch/maw v7.0
 S BGPMTAX=$P($P(BGPSTR,P,7),R)
 S BGPDEMO=$P(BGPSTR,P,8)
 I BGPDEMO="" S BGPDEMO="@"  ;8.0 p2
 S BGPOUT=$P(BGPSTR,P,9)
 S BGPEDIR=$P(BGPSTR,P,10)
 I '$G(BGPEISS) S BGPMTAX="@"  ; remove taxonomy if not mfi site
 K ^BGPTMP($J)
 S RETVAL="^BGPTMP("_$J_")"
 S ^BGPTMP($J,BGPI)="T00007BMXIEN^T00030Error"_$C(30)
 N BGPFDA,BGPIENS,BGPERR
 I $O(^BGPSITE("B",BGPFAC,0)) D
 . S BGPIENS=$O(^BGPSITE("B",BGPFAC,0))_","
 . S BGPFDA(90241.02,BGPIENS,.05)=BGPTAX
 . S BGPFDA(90241.02,BGPIENS,.02)=BGPHLOC
 . S BGPFDA(90241.02,BGPIENS,.08)=BGPEISS
 . S BGPFDA(90241.02,BGPIENS,.06)=BGPCHS
 . S BGPFDA(90241.02,BGPIENS,.09)=BGPMTAX
 . S BGPFDA(90241.02,BGPIENS,.11)=BGPHTWT  ;cmi anch/maw v7.0
 . S BGPFDA(90241.02,BGPIENS,.12)=BGPDEMO  ;cmi/maw 8.0 p2
 . S BGPFDA(90241.02,BGPIENS,.13)=BGPOUT
 . S BGPFDA(90241.02,BGPIENS,.14)=BGPEDIR
 . D FILE^DIE("K","BGPFDA","BGPERR(1)")
 . I $G(BGPERR(1)) D  Q
 .. S BGPI=BGPI+1
 .. S ^BGPTMP($J,BGPI)="1^Error Saving Site Parameters"
 . S BGPI=BGPI+1
 . S ^BGPTMP($J,BGPI)="0^Site Parameters Saved"
 I '$O(^BGPSITE("B",BGPFAC,0)) D
 . S BGPIENS=""
 . S BGPIENS(1)=BGPFAC
 . S BGPFDA(90241.02,"+1,",.01)=BGPFAC
 . S BGPFDA(90241.02,"+1,",.02)=BGPHLOC
 . S BGPFDA(90241.02,"+1,",.04)=BGPEISS
 . S BGPFDA(90241.02,"+1,",.05)=BGPTAX
 . S BGPFDA(90241.02,"+1,",.06)=BGPCHS
 . S BGPFDA(90241.02,"+1,",.09)=BGPMTAX
 . S BGPFDA(90241.02,"+1,",.11)=BGPHTWT
 . S BGPFDA(90241.02,"+1,",.12)=BGPDEMO  ; 8.0 p2
 . S BGPFDA(90241.02,"+1,",.13)=BGPOUT
 . S BGPFDA(90241.02,"+1,",.14)=BGPEDIR
 . D UPDATE^DIE("","BGPFDA","BGPIENS","BGPERR(1)")
 . I $G(BGPERR(1)) D  Q
 .. S BGPI=BGPI+1
 .. S ^BGPTMP($J,BGPI)="1^Error Saving Site Parameters"
 . S BGPI=BGPI+1
 . S ^BGPTMP($J,BGPI)="0^Site Parameters Saved"
 S ^BGPTMP($J,BGPI+1)=$C(31)
 D EN^XBVK("BGP")
 Q
 ;
LST(RETVAL,BGPSTR) ;-- list files
 S X="MERR^BGPGU",@^%ZOSF("TRAP") ; m error trap
 N BGPI,BGPJ,BGPDATA,BGPDA,P,BGPERR,BGPCT,BGPYN,BGPOT,BGPOPT,BGPRT
 S P="|"
 S BGPI=0
 S BGPERR=""
 S BGPCT=$P(BGPSTR,P)
 S BGPCT=$O(^ATXAX("B",BGPCT,0))
 S BGPYN=$P(BGPSTR,P,2)
 S BGPOT=$P(BGPSTR,P,3)
 S BGPOPT=$P(BGPSTR,P,4)
 S BGPRT=$P(BGPSTR,P,5)
 K ^BGPTMP($J)
 S RETVAL="^BGPTMP("_$J_")"
 S ^BGPTMP($J,BGPI)="T00250DATA"_$C(30)
 D EP^BGP5GLST(.BGPERR,DUZ,DUZ(2),BGPOPT,BGPCT,BGPYN,BGPOT,BGPRT)
 S BGPI=BGPI+1
 S ^BGPTMP($J,BGPI)=$G(BGPERR)_$C(30)
 S ^BGPTMP($J,BGPI+1)=$C(31)_BGPERR
 D EN^XBVK("BGP")
 Q
 ;
DELRPT(RETVAL,BGPSTR) ;-- delete a report out of the BGP 05 GUI REPORT file
 S X="MERR^BGPGU",@^%ZOSF("TRAP") ; m error trap
 N P,R,I
 S P="|",R="~"
 S BGPERR=""
 K ^BGPTMP($J)
 S RETVAL="^BGPTMP("_$J_")"
 F I=2:1 D  Q:$P(BGPSTR,R,I)=""
 . N BGPI
 . Q:$P(BGPSTR,R,I)=""
 . S BGPI=$P(BGPSTR,R,I)
 . S DIK="^BGPGUI(",DA=BGPI D ^DIK
 S ^BGPTMP($J,0)="T00250DATA"_$C(30)
 S ^BGPTMP($J,1)=$G(BGPERR)_$C(30)
 S ^BGPTMP($J,2)=$C(31)_BGPERR
 Q
 ;
ST(RETVAL,BGPSTR) ;-- return search templates by file
 S X="MERR^BGPGU",@^%ZOSF("TRAP") ; m error trap
 N P,BGPI,R,BGPFLS
 S P="|",R="~"
 S BGPFLS=$P(BGPSTR,P)
 K ^BGPTMP($J)
 S RETVAL="^BGPTMP("_$J_")"
 S BGPI=0
 S ^BGPTMP($J,BGPI)="T00007BMXIEN^T00050Search Template"_$C(30)
 N I
 F I=1:1 D  Q:$P(BGPFLS,R,I)=""
 . Q:$P(BGPFLS,R,I)=""
 . S BGPFLS($P(BGPFLS,R,I))=$P(BGPFLS,R,I)
 N BGPDA
 S BGPDA=0 F  S BGPDA=$O(^DIBT("B",BGPDA)) Q:BGPDA=""  D
 . N BGPIEN
 . S BGPIEN=0 F  S BGPIEN=$O(^DIBT("B",BGPDA,BGPIEN)) Q:'BGPIEN  D
 .. N BGLFL
 .. S BGPFL=$P($G(^DIBT(BGPIEN,0)),U,4)
 .. Q:'BGPFL
 .. Q:'$D(BGPFLS(BGPFL))
 .. S BGPI=BGPI+1
 .. S ^BGPTMP($J,BGPI)=BGPIEN_U_$P($G(^DIBT(BGPIEN,0)),U)_$C(30)
 S ^BGPTMP($J,BGPI+1)=$C(31)
 D EN^XBVK("BGP")
 Q
 ;
UPL(RETVAL,BGPSTR) ;-- upload a file
 S X="MERR^BGPGU",@^%ZOSF("TRAP") ; m error trap
 N P,BGPOPT,BGPI,R
 S P="|",R="~"
 K ^BGPTMP($J)
 S RETVAL="^BGPTMP("_$J_")"
 S BGPI=0
 S BGPOPT="BGP 05 UPLOAD FILES"
 N I
 F I=1:1 D  Q:$P(BGPSTR,P,I)=""
 . Q:$P(BGPSTR,P,I)=""
 . N BGPFD,BGPDIR,BGPFL
 . S BGPFD=$P(BGPSTR,P,I)
 . S BGPDIR=$P(BGPFD,R,1)
 . S BGPFL=$P(BGPFD,R,2)
 . D EP^BGP5GUPL(.BGPERR,DUZ,DUZ(2),BGPOPT,BGPDIR,BGPFL,DT)
 S ^BGPTMP($J,BGPI)="T00080Result"_$C(30)
 S BGPI=BGPI+1
 S ^BGPTMP($J,BGPI)=+$G(BGPERR)_$C(30)
 S ^BGPTMP($J,BGPI+1)=$C(31)
 D EN^XBVK("BGP")
 Q
 ;
LSTF(RETVAL,BGPSTR) ;-- list files
 S X="MERR^BGPGU",@^%ZOSF("TRAP") ; m error trap
 N P,BGPDIR,BGPFL,BGPOPT,BGPI
 S P="|"
 K ^BGPTMP($J)
 S RETVAL="^BGPTMP("_$J_")"
 S BGPI=0
 S BGPDIR=$P(BGPSTR,P)
 K BGPLIST S BGPLIST="",X=$$LIST^%ZISH(BGPDIR,"BG05*",.BGPLIST)
 S BGPOPT="BGP 05 UPLOAD FILES"
 S ^BGPTMP($J,BGPI)="T00080Directory^T00080File Name"_$C(30)
 N BGPDA
 S BGPDA=0 F  S BGPDA=$O(BGPLIST(BGPDA)) Q:'BGPDA  D
 . N BGPFL
 . S BGPFL=$G(BGPLIST(BGPDA))
 . S BGPI=BGPI+1
 . S ^BGPTMP($J,BGPI)=BGPDIR_U_BGPFL_$C(30)
 S ^BGPTMP($J,BGPI+1)=$C(31)
 D EN^XBVK("BGP")
 Q
 ;
CHK(BGPRET,BGPSTR) ;check report status
 S X="MERR^BGPGU",@^%ZOSF("TRAP") ; m error trap
 N P,BGPDUZ2,BGPI
 S P="|"
 S BGPDUZ=$P(BGPSTR,P)
 K ^BGPTMP($J)
 S BGPRET="^BGPTMP("_$J_")"
 S BGPI=0
 S ^BGPTMP($J,BGPI)="T00007BMXIEN^T00030Name^T00030User^T00020Start Time^T00020End Time^T00030Type of Report^T00020Report Status^T00020Type of Output"_$C(30)
 N BGPDA
 S BGPDA=0 F  S BGPDA=$O(^BGPGUI("AUSR",BGPDUZ,BGPDA)) Q:'BGPDA  D
 . N BGPIEN
 . S BGPIEN=0 F  S BGPIEN=$O(^BGPGUI("AUSR",BGPDUZ,BGPDA,BGPIEN)) Q:'BGPIEN  D
 .. N BGPDATA,BGPNM,BGPUSER,BGPST,BGPET,BGPTOR,BGPRS,BGPTOO
 .. S BGPDATA=$G(^BGPGUI(BGPIEN,0))
 .. S BGPNM=$P(BGPDATA,U)
 .. S BGPUSER=$P($G(^VA(200,$P(BGPDATA,U,2),0)),U)
 .. S BGPST=$$FMTE^XLFDT($P(BGPDATA,U,3))
 .. S BGPET=$$FMTE^XLFDT($P(BGPDATA,U,4))
 .. I $P(BGPDATA,U,4)="",$$SEVEN^BGP6GU(BGPST) D  Q
 ... S DIK="^BGPGUIS(",DA=BGPDA D ^DIK
 .. S BGPTOR=$P(BGPDATA,U,5)
 .. S BGPRS=$$GET1^DIQ(90372.08,BGPIEN,.06)
 .. S BGPTOO=$$GET1^DIQ(90372.08,BGPIEN,.07)
 .. S BGPI=BGPI+1
 .. S ^BGPTMP($J,BGPI)=BGPIEN_U_BGPNM_U_BGPUSER_U_BGPST_U_BGPET_U_BGPTOR_U_BGPRS_U_BGPTOO_$C(30)
 S ^BGPTMP($J,BGPI+1)=$C(31)
 Q
 ;
ADDST(BGPRET,BGPSTR) ;-- add a search template
 S X="MERR^BGPGU",@^%ZOSF("TRAP") ; m error trap
 N P,BGPDUZ2,BGPI,BGPNM
 S P="|"
 S BGPNM=$P(BGPSTR,P)
 K ^BGPTMP($J)
 S BGPRET="^BGPTMP("_$J_")"
 S BGPI=0
 S ^BGPTMP($J,BGPI)="T00007Error"_$C(30)
 N BGPFDA,BGPIENS,BGPERR
 S BGPIENS=""
 S BGPFDA(.401,"+1,",.01)=BGPNM
 S BGPFDA(.401,"+1,",2)=DT
 S BGPFDA(.401,"+1,",4)=9000001
 S BGPFDA(.401,"+1,",5)=DUZ
 S DIC="^DIBT("
 D UPDATE^DIE("","BGPFDA","BGPIENS","BGPERR(1)")
 I $G(BGPIENS(1)) S ^BGPTMP($J,1)=$G(BGPIENS(1))_$C(30)
 S ^BGPTMP($J,2)=$C(31)
 Q
 ;
RC(RETVAL,BGPSTR) ;EP -- return record counts for a file for the BH GUI Search Form (frmSearchSingle, frmSearchMultiple)
 N BGPGB
 S BGPGB=$G(^DIC(BGPSTR,0,"GL"))_"0)"
 I BGPGB'[U S RETVAL=0
 S RETVAL=$P($G(@BGPGB),U,4)
 I RETVAL="" S RETVAL=0
 Q
 ;