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

BGP7GAPU.m

Go to the documentation of this file.
  1. BGP7GAPU ; IHS/CMI/LAB - AREA NATIONAL GPRA REPORT ;
  1. ;;17.1;IHS CLINICAL REPORTING;;MAY 10, 2017;Build 29
  1. ;
  1. ;
  1. TESTNTL ;
  1. S ERR=""
  1. S BGPSUL(1)=""
  1. S BGPSUL(2)=""
  1. D EP(.ERR,1,2522,"BGP 17 AREA GPU","A",.BGPSUL,1,3030000,3000000,1,"B",$$NOW^XLFDT)
  1. W !,ERR
  1. Q
  1. EP(BGPRET,BGPUSER,BGPDUZ2,BGPOPTN,BGPRPTT,BGPSUL,BGPQTR,BGPPER,BGPVDT,BGPBEN,BGPROT,BGPRTIME,BGPFILE,BGPDNT) ;EP - called from GUI to produce national gpra report (AO-AGP)
  1. ;SEE ROUTINE BGP7DAR for more info
  1. ; BGPUSER - DUZ
  1. ; BGPDUZ2 - DUZ(2)
  1. ; BGPOPTN - OPTION NAME
  1. ; BGPRPTT - A or F depending on whether site wants area or facility report, either way you need to display the entries to the user
  1. ; from BGP 17 DATA CURRENT that match the following:
  1. ; (SEE BGP7ASL or CALL ME)
  1. ; BGPSUL - array containing Iens from BGP 17 DATA CURRENT that the user selected
  1. ; ; BGPSUL - ARRAY OF IENS FROM THE D GET^BGP7ASL(.BGPSUL,.BGPFILE,9,....... call that the user selected
  1. ; BGPQTR - this is equal to 1,2,3,4 or 5 depending on how the user answers the following
  1. ; DIR call:
  1. ; Select one of the following:
  1. ;
  1. ; 1 January 1 - December 31
  1. ; 2 April 1 - March 31
  1. ; 3 July 1 - June 30
  1. ; 4 October 1 - September 30
  1. ; 5 User defined date range
  1. ; Enter the date range for your report:
  1. ;
  1. ; BGPPER - this is the year they select if they answered the above question
  1. ; with a 1 through 4 e.g 305000 (fileman imprecise date for 2010)
  1. ; if they chose 5 then this will be the end date the enter
  1. ;
  1. ; BGPVDT - baseline year entered by user in internal fileman format, year only
  1. ; e.g. 3010000
  1. ;
  1. ; BGPBEN - 1 for Indians only, 2 for Not Indian, 3 for both (see reader call
  1. ; at subroutine BEN in BGP7DL
  1. ;
  1. ; BGPROT - type of output P for printed, D For Delimited, B for both
  1. ; BGPRTIME - report will be queued automatically, this variable
  1. ; contains the time it will run, internal fileman format
  1. ; must be date and time
  1. ; BGPRET - return value is ien^error message a zero (0)^NAME OF EXCEL FILE IF CHOSEN TO DO SO is
  1. ; passed as ien if error occurred, display the filename back to the user
  1. ; if they chose to export to area
  1. ;
  1. ;create entry in gui output file
  1. ;queue report to run with/GUIR
  1. D EP1
  1. S Y=BGPRET
  1. ;D EN^XBVK("BGP") S:$D(ZTQUEUED) ZTREQ="@"
  1. S BGPRET=Y
  1. Q
  1. EP1 ;
  1. S U="^"
  1. I $G(BGPUSER)="" S BGPRET=0_"^USER NOT PASSED" Q
  1. I $G(BGPDUZ2)="" S BGPRET=0_"^DUZ(2) NOT PASSED" Q
  1. I $G(BGPOPTN)="" S BGPRET=0_"^OPTION NAME NOT PASSED" Q
  1. I $G(BGPRPTT)="" S BGPRET=0_"^AREA OR FACILITY VARIABLE NOT PASSED" Q
  1. I $G(BGPPER)="" S BGPRET=0_"^YEAR VARIABLE NOT PASSED" Q
  1. I $G(BGPQTR)="" S BGPRET=0_"^QUARTER/DATE TYPE NOT PASSED" Q
  1. I $G(BGPVDT)="" S BGPRET=0_"^BASELINE YEAR NOT PASSED" Q
  1. I $G(BGPBEN)="" S BGPRET=0_"^BENIFICIARY TYPE NOT PASSED" Q
  1. I "AF"'[BGPRPTT S BGPRET=0_"^AREA OR FACILTY VARIABLE INVALID" Q
  1. I "PDB"'[$G(BGPROT) S BGPRET=0_"^REPORT OUTPUT TYPE NOT PASSED" Q
  1. I '$D(BGPSUL) S BGPRET=0_"^FACILITY ARRAY NOT PASSED" Q
  1. S X=0,C=0 F S X=$O(BGPSUL(X)) Q:X'=+X S C=C+1
  1. I 0 S BGPRET=0_"^FACILITY ARRAY NOT PASSED" Q
  1. S BGPSUCNT=0
  1. S BGPSUCNT=C
  1. I BGPSUCNT=1 S Y=$O(BGPSUL(0)),X=$P(^BGPGPDCG(Y,0),U,9),X=$O(^AUTTLOC("C",X,0)) I X S BGPSUNM=$P(^DIC(4,X,0),U)
  1. S BGPRTIME=$G(BGPRTIME)
  1. ;S DUZ=BGPUSER
  1. S DUZ(2)=BGPDUZ2
  1. S:'$D(DT) DT=$$DT^XLFDT
  1. D ^XBKVAR
  1. S BGPGUI=1
  1. S IOM=80,BGPIOSL=55
  1. S BGPAREAA=1
  1. S BGPRTYPE=1,BGPYRPTH="",BGPYGPU=1
  1. S BGPHOME=$P($G(^BGPSITE(DUZ(2),0)),U,2)
  1. S X=0 F S X=$O(^BGPINDG("GPRA",1,X)) Q:X'=+X S BGPIND(X)=""
  1. S BGPINDG="G"
  1. I BGPQTR=1 S BGPBD=$E(BGPPER,1,3)_"0101",BGPED=$E(BGPPER,1,3)_"1231"
  1. I BGPQTR=2 S BGPBD=($E(BGPPER,1,3)-1)_"0401",BGPED=$E(BGPPER,1,3)_"0331"
  1. I BGPQTR=3 S BGPBD=($E(BGPPER,1,3)-1)_"0701",BGPED=$E(BGPPER,1,3)_"0630"
  1. I BGPQTR=4 S BGPBD=($E(BGPPER,1,3)-1)_"1001",BGPED=$E(BGPPER,1,3)_"0930"
  1. I BGPQTR=5 D
  1. .S D=$$FMADD^XLFDT(BGPPER,1)
  1. .I $E(BGPPER,4,7)'=1231 S BGPBD=($E(BGPPER,1,3)-1)_$E(D,4,7),BGPED=BGPPER,BGPPER=$E(BGPED,1,3)_"0000"
  1. .I $E(BGPPER,4,7)=1231 S BGPBD=$E(BGPPER,1,3)_$E(D,4,7),BGPED=BGPPER,BGPPER=$E(BGPED,1,3)_"0000"
  1. I ^%ZOSF("OS")["PC"!(^%ZOSF("OS")["NT")!($P($G(^AUTTSITE(1,0)),U,21)=2) S BGPUF=$S($P($G(^AUTTSITE(1,1)),U,2)]"":$P(^AUTTSITE(1,1),U,2),1:"C:\EXPORT")
  1. S X=$E(BGPPER,1,3)-$E(BGPVDT,1,3)
  1. S X=X_"0000"
  1. S BGPBBD=BGPBD-X,BGPBBD=$E(BGPBBD,1,3)_$E(BGPBD,4,7)
  1. S BGPBED=BGPED-X,BGPBED=$E(BGPBED,1,3)_$E(BGPED,4,7)
  1. S BGPPBD=($E(BGPBD,1,3)-1)_$E(BGPBD,4,7)
  1. S BGPPED=($E(BGPED,1,3)-1)_$E(BGPED,4,7)
  1. S X=0 F S X=$O(^BGPINDG("GPRA",1,X)) Q:X'=+X S BGPIND(X)=""
  1. S BGPINDG="G"
  1. S BGPASUF=$P(^AUTTLOC(DUZ(2),0),U,10)
  1. S BGPDELT="",BGPEXCEL=""
  1. ;create entry in GUI file
  1. D ^XBFMK
  1. S X=BGPFILE
  1. S DIC="^BGPGUIG(",DIC(0)="L",DIADD=1,DLAYGO=90558.19,DIC("DR")=".02////"_BGPUSER_";.03////"_$S(BGPRTIME]"":BGPRTIME,1:$$NOW^XLFDT)_";.05///"_BGPOPTN_";.06///R;.07///"_$G(BGPROT)
  1. K DD,D0,DO D FILE^DICN K DLAYGO,DIADD,DD,D0,DO
  1. I Y=-1 S BGPRET=0_"^UNABLE TO CREATE ENTRY IN GUI OUTPUT FILE" Q
  1. S BGPGIEN=+Y
  1. ;SEND THE REPORT PROCESS OFF TO THE BACKGROUND USING TASKMAN CALL
  1. D TSKMN
  1. S BGPRET=BGPGIEN
  1. Q
  1. ;
  1. TSKMN ;
  1. S ZTIO=""
  1. K ZTSAVE S ZTSAVE("*")=""
  1. S ZTCPU=$G(IOCPU),ZTRTN="AOAGP^BGP7GAPU",ZTDTH=$S(BGPRTIME]"":BGPRTIME,1:$$NOW^XLFDT),ZTDESC="GUI NATIONAL GPRA REPORT 06" D ^%ZTLOAD
  1. D UPLOG^BGP7GUA(BGPGIEN,ZTSK)
  1. Q
  1. AOAGP ;
  1. K ^TMP($J,"BGPGUI")
  1. S IOM=80,BGPIOSL=55
  1. D GUIR^BGPXBLM("PRINT^BGP7PARP","^TMP($J,""BGPGUI"",")
  1. ;cmi/anch/maw added 5/12/2009 for word output
  1. S X=0,C=0 F S X=$O(^TMP($J,"BGPGUI",X)) Q:X'=+X D
  1. . S C=C+1
  1. . N BGPDATA
  1. . S BGPDATA=$G(^TMP($J,"BGPGUI",X))
  1. . I BGPDATA="ZZZZZZZ" S BGPDATA=$C(12)
  1. . S ^BGPGUIG(BGPGIEN,11,C,0)=BGPDATA
  1. S ^BGPGUIG(BGPGIEN,11,0)="^90558.1911^"_C_"^"_C_"^"_DT
  1. K ^TMP($J,"BGPGUI")
  1. ;cmi/anch/maw end of mods
  1. D ENDLOG
  1. D XIT
  1. Q
  1. ;
  1. XIT ;
  1. K ^TMP($J)
  1. D EN^XBVK("BGP") S:$D(ZTQUEUED) ZTREQ="@"
  1. K DIRUT,DUOUT,DIR,DOD
  1. K DIADD,DLAYGO
  1. D KILL^AUPNPAT
  1. K X,X1,X2,X3,X4,X5,X6
  1. K A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,V,W,X,Y,Z
  1. K N,N1,N2,N3,N4,N5,N6
  1. K BD,ED
  1. D KILL^AUPNPAT
  1. D ^XBFMK
  1. L -^BGPDATA
  1. Q
  1. ;
  1. ENDLOG ;-- UPDATE LOG AT END
  1. S DIE="^BGPGUIG(",DA=BGPGIEN,DR=".04////"_$$NOW^XLFDT_";.06///C"
  1. D ^DIE
  1. K DIE,DR,DA
  1. Q