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

BGP3GAON.m

Go to the documentation of this file.
  1. BGP3GAON ; IHS/CMI/LAB - AREA OTHER NATIONAL MEASURES GPRA REPORT 01 Jul 2010 1:10 PM ;
  1. ;;13.0;IHS CLINICAL REPORTING;;NOV 20, 2012;Build 81
  1. ;
  1. ;
  1. TESTNTL ;
  1. S ERR=""
  1. S BGPSUL(1)=""
  1. S BGPSUL(2)=""
  1. D EP(.ERR,1,2522,"BGP 13 AREA OTHER NATIONAL MEASURES REPORT","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,BGPHC,BGPFILE) ;EP - called from GUI to produce national gpra report (AO-AGP)
  1. ;SEE ROUTINE BGP3DAR 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 13 DATA CURRENT that match the following:
  1. ; (SEE BGP3ASL or CALL ME)
  1. ; BGPSUL - array containing Iens from BGP 13 ONM DATA CURRENT that the user selected
  1. ; BGPSUL - ARRAY OF IENS FROM THE D GET^BGP3ASL(.BGPSUL,.BGPFILE,5,....... 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 BGP3DL
  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(BGPHC),$G(BGPPER)="" S BGPRET=0_"^YEAR VARIABLE NOT PASSED" Q
  1. I '$G(BGPHC),$G(BGPQTR)="" S BGPRET=0_"^QUARTER/DATE TYPE NOT PASSED" Q
  1. I '$G(BGPHC),$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(^BGPGPDCH(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=7,BGPYRPTH=""
  1. S BGPHOME=$P($G(^BGPSITE(DUZ(2),0)),U,2)
  1. S X=0 F S X=$O(^BGPINDH("ON",1,X)) Q:X'=+X S BGPIND(X)=""
  1. S BGPINDH="G"
  1. I '$G(BGPHC) D
  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 S BGPBD=$$FMADD^XLFDT(BGPPER,-364),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. I $G(BGPHC)="U" D
  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 BGPBEN=1
  1. S BGPASUF=$P(^AUTTLOC(DUZ(2),0),U,10)
  1. S BGPRTC="U"
  1. I $G(BGPHC)="H" D
  1. .S BGPRTC="H"
  1. .S (BGPBD,BGPED,BGPTP)=""
  1. .S X=$O(^BGPCTRL("B",2013,0))
  1. .S Y=^BGPCTRL(X,0)
  1. .S BGPBD=$P(Y,U,8),BGPED=$P(Y,U,9)
  1. .S BGPPBD=$P(Y,U,10),BGPPED=$P(Y,U,11)
  1. .S BGPBBD=$P(Y,U,12),BGPBED=$P(Y,U,13)
  1. .S BGPPER=$P(Y,U,14),BGPQTR=3
  1. .S BGPBEN=1
  1. S BGPDELT="",BGPEXCEL=1
  1. S BGPC=0,X=0 F S X=$O(BGPSUL(X)) Q:X'=+X S BGPC=BGPC+1
  1. S BGPNOW=$$NOW^XLFDT() S BGPNOW=$P(BGPNOW,".")_"."_$$RZERO^BGP3UTL($P(BGPNOW,".",2),6)
  1. S BGPFONN1="CRSONMNT1"_$P(^AUTTLOC(DUZ(2),0),U,10)_2010063000000000_$$D^BGP3UTL(BGPNOW)_"_"_$$LZERO^BGP3UTL(BGPC,6)_".TXT"
  1. S BGPFONN2="CRSONMNT2"_$P(^AUTTLOC(DUZ(2),0),U,10)_2010063000000000_$$D^BGP3UTL(BGPNOW)_"_"_$$LZERO^BGP3UTL(BGPC,6)_".TXT"
  1. S BGPFONN3="CRSONMNT3"_$P(^AUTTLOC(DUZ(2),0),U,10)_2010063000000000_$$D^BGP3UTL(BGPNOW)_"_"_$$LZERO^BGP3UTL(BGPC,6)_".TXT"
  1. S BGPFONN4="CRSONMNT4"_$P(^AUTTLOC(DUZ(2),0),U,10)_2010063000000000_$$D^BGP3UTL(BGPNOW)_"_"_$$LZERO^BGP3UTL(BGPC,6)_".TXT"
  1. S BGPFONN5="CRSONMNT5"_$P(^AUTTLOC(DUZ(2),0),U,10)_2010063000000000_$$D^BGP3UTL(BGPNOW)_"_"_$$LZERO^BGP3UTL(BGPC,6)_".TXT"
  1. ;create entry in GUI file
  1. D ^XBFMK
  1. S X=BGPFILE
  1. S DIC="^BGPGUIH(",DIC(0)="L",DIADD=1,DLAYGO=90549.19
  1. S DIC("DR")=".02////"_BGPUSER_";.03////"_$S(BGPRTIME]"":BGPRTIME,1:$$NOW^XLFDT)_";.05///"_BGPOPTN_";.06///R;.07///"_$G(BGPROT)_";1///"_$G(BGPFONN1)_", "_$G(BGPFONN2)_", "_$G(BGPFONN3)_", "_$G(BGPFONN4) ;_", "_$G(BGPFONN5)
  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. S $P(BGPRET,"~",3)=$G(BGPFONN1)_","_$G(BGPFONN2)_","_$G(BGPFONN3)_","_$G(BGPFONN4)_","_$G(BGPFONN5)
  1. Q
  1. ;
  1. TSKMN ;
  1. S ZTIO=""
  1. K ZTSAVE S ZTSAVE("*")=""
  1. S ZTCPU=$G(IOCPU),ZTRTN="AONM^BGP3GAON",ZTDTH=$S(BGPRTIME]"":BGPRTIME,1:$$NOW^XLFDT),ZTDESC="GUI AREA ONM REPORT" D ^%ZTLOAD Q
  1. Q
  1. AONM ;
  1. K ^TMP($J,"BGPGUI")
  1. S IOM=80,BGPIOSL=55
  1. ;cmi/anch/maw added 5/12/2010 for word output
  1. D GUIR^BGPXBLM("PRINT^BGP3PARQ","^TMP($J,""BGPGUI"",")
  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 ^BGPGUIH(BGPGIEN,11,C,0)=BGPDATA
  1. S ^BGPGUIH(BGPGIEN,11,0)="^90549.1911^"_C_"^"_C_"^"_DT
  1. I BGPRPTT="A" D ONN1^BGP3UTL
  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="^BGPGUIH(",DA=BGPGIEN,DR=".04////"_$$NOW^XLFDT_";.06///C"
  1. D ^DIE
  1. K DIE,DR,DA
  1. Q