source: FOIAVistA/trunk/r/HEALTH_SUMMARY-GMTS/GMTSPP.m@ 1528

Last change on this file since 1528 was 628, checked in by George Lilly, 15 years ago

initial load of FOIAVistA 6/30/08 version

File size: 4.3 KB
Line 
1GMTSPP ;SLC/KER - Define HS Print-by-Location Parameters ; 09/21/2001
2 ;;2.7;Health Summary;**2,30,47**;Oct 20, 1995
3 ;
4 ; External References
5 ; DBIA 10003 DD^%DT
6 ; DBIA 10006 ^DIC
7 ; DBIA 2051 FIND^DIC
8 ; DBIA 10018 ^DIE
9 ; DBIA 2056 $$GET1^DIQ
10 ; DBIA 10026 ^DIR
11 ;
12MAIN ; Print by Location
13 K DIC,DIE,DIR
14 S DIC=19.2,DIC(0)="F",X="GMTS TASK STARTUP" S Y=$$SDT(X)
15 I Y<0 D ALERT K X,Y G MAIN1
16 I Y>DT D QUEOK K Y G MAIN1
17 D ALERT
18MAIN1 ; Controls Branching
19 F D GETDATA Q:$D(PPQIT)!$D(DTOUT)
20 K CLINIC,DIROUT,DIRUT,DTOUT,DUOUT,GMTSIFN,GMTSLOC,J1,J2,NEWTYP,PPQIT,X,B,C,D0,DI,DIJ,DISYS,DP,DQ,P
21 Q
22QUEOK ; Informs user of print time if queued to print
23 D DD^%DT S QTIM=Y K Y
24 W !!,"For your information:",!
25 W "Health Summary Batches are queued to print nightly at ",QTIM,!
26 W "and should be available for distribution by early morning.",!
27 K QTIM
28 Q
29ALERT ; Warns user that summaries have not been queued
30 W !!," ***Alert***",!!
31 W "Health Summary batches have not been queued to print or date is not current.",!
32 W "Please ask your IRM SERVICE to queue option GMTS TASK STARTUP",!
33 W "to run nightly. Parameters may be set now but will not produce",!
34 W "Health Summaries until option is queued."
35 Q
36GETDATA ; Selects Location/Health Summary Type and Edits parameters
37 S DIC=44,DIC(0)="AEMQZ",DIC("A")="Select Hospital Location: ",DIC("S")="I ""WCOR""[$P(^(0),U,3)" W ! D ^DIC K DIC
38 I Y=-1 K X,Y S PPQIT=1 Q
39 S GMTSLOC=+Y,GMTSLNM=$P(Y,U,2),CLINIC=$S("COR"[$P(Y(0),U,3):1,1:0) K X,Y
40 I $O(^GMT(142,"D",GMTSLOC,0)) D DISPLAY
41 K GMTSLNM
42 S DIC=142,DIC(0)="AEQ",DIC("A")="Select Health Summary Type: " S Y=$$TYPE^GMTSULT K DIC
43 I X="" K X,Y Q
44 I Y=-1 K X,Y S PPQIT=1 Q
45 S GMTSIFN=+Y,NEWTYP=1,TYP1=0
46 F S TYP1=$O(^GMT(142,"D",GMTSLOC,TYP1)) Q:TYP1="" I GMTSIFN=TYP1 S NEWTYP=0 Q
47 S GMTSUM=$P(Y,U,2),GMTSNEW=0,EXISTS=1,GMTSQIT=0 K X,Y D LIST^GMTSRM
48 K GMTSNEW,EXISTS,GMTSQIT,GMTSUM,TYP1
49 Q:$D(DUOUT) I $D(DIRUT) S PPQIT=1 Q
50 I NEWTYP=1 D NEW Q
51 S DIR(0)="Y",DIR("A")="Do you wish to delete this Health Summary Type from the nightly print",DIR("B")="NO"
52 W ! D ^DIR K DIR
53 Q:$D(DUOUT) I $D(DIRUT) S PPQIT=1 Q
54 S DIE="^GMT(142,"_GMTSIFN_",20,",DIE("NO^")="OUTOK",DA(1)=GMTSIFN
55 S DA=$O(^GMT(142,"D",GMTSLOC,GMTSIFN,0)),DEL=0
56 I Y=1 S DR=".01///@",DEL=1
57 K X,Y
58 E S:CLINIC DR=".02;I $P($G(^GMT(142.99,1,0)),U,2)'=""Y"" S Y=""@1"";.03;@1;.04//0" S:'CLINIC DR=".02;I $P($G(^GMT(142.99,1,0)),U,2)'=""Y"" S Y=0;.03" W !
59 D ^DIE
60 I DEL W !!,"**Print for Health Summary Type deleted**"
61 K DIE,DA,DR,X,Y,DEL
62 Q
63DISPLAY ; Displays Health Summary Types associated with Location
64 W !!,"At present the following Health Summary Types are printed for ",GMTSLNM,":"
65 W !?70,"Action",!?2,"Type",?32,"Device" W:CLINIC ?54,"Days Ahead" W ?70,"Profile",!
66 S DEVFLG=0
67 S TYP=0 F J1=1:1 S TYP=$O(^GMT(142,"D",GMTSLOC,TYP)) Q:TYP="" D WRITE
68 I DEVFLG W !!,"*This Type will not print since Device is invalid or has not been entered"
69 W !!,"You may edit a Health Summary Type from the list or enter a new Type",!
70 K TYP,DEVFLG
71 Q
72WRITE ; Writes Health Summary Type with parameters
73 S TYPNM=$P(^GMT(142,TYP,0),U),LOCIFN=$O(^GMT(142,"D",GMTSLOC,TYP,0))
74 S DATA=^GMT(142,TYP,20,LOCIFN,0),DEV=$P(DATA,U,2)
75 S X="`"_DEV,DIC=3.5,DIC(0)="" D ^DIC
76 I +Y'>0 S DEVFLG=1
77 S DEVNM=$S(+Y>0:$P(Y,U,2),DEV="":"None",1:DEV_" (Invalid)")
78 W !,$S(+Y'>0:"*",1:" "),TYPNM,?32,$E(DEVNM,1,21),?59,$P(DATA,U,4),?72,$S($P(DATA,U,3)="Y":"Yes",1:"No") K DIC,X,Y
79 K DATA,DAYS,DEV,DEVNM,LOCIFN,TYPNM
80 Q
81NEW ; Sets parameters for new Health Summary Type
82 S (NI,LI)=0 I $D(^GMT(142,GMTSIFN,20,0)) F S NI=$O(^GMT(142,GMTSIFN,20,NI)) Q:NI'>0 S LI=NI
83 S:'$D(^GMT(142,GMTSIFN,20,0)) ^(0)="^142.2P^^"
84 S DIE="^GMT(142,"_GMTSIFN_",20,",DA(1)=GMTSIFN,DA=LI+1,DIE("NO^")="OUTOK"
85 I CLINIC S DR=".01////"_GMTSLOC_";.02;I $P($G(^GMT(142.99,1,0)),U,2)'=""Y"" S Y=""@1"";.03;@1;.04//0"
86 E S DR=".01////"_GMTSLOC_";.02;I $P($G(^GMT(142.99,1,0)),U,2)'=""Y"" S Y=0;.03"
87 W ! D ^DIE K DIE,DA,DR,X,Y,NI,LI,J3
88 Q
89SDT(X) ; Get the last schedule date/time
90 N GMTSM,GMTSR,GMTSI,GMTSE,GMTSDA S (GMTSI,GMTSM)=0
91 D FIND^DIC(19.2,,,"X",X,5,,,,"GMTSDA")
92 F S GMTSI=$O(GMTSDA("DILIST",2,GMTSI)) Q:GMTSI'>0 D
93 . S GMTSE=GMTSDA("DILIST",2,GMTSI) Q:+GMTSE'>0
94 . S GMTSR=$$GET1^DIQ(19.2,(GMTSE_","),2,"I")
95 . S:+GMTSR>GMTSM GMTSM=+GMTSR
96 S X=$S(+($G(GMTSM))>0:+($G(GMTSM)),1:-1) Q X
Note: See TracBrowser for help on using the repository browser.