source: WorldVistAEHR/trunk/r/LAB_SERVICE-LR-LS/LRFAC.m@ 1766

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

initial load of WorldVistAEHR

File size: 4.5 KB
Line 
1LRFAC ;MILW/JMC/DALISC/FHS - CUM PRINT FOR FILEROOM PATIENTS TO SEPARATE PRINTER
2 ;;5.2;LAB SERVICE;;Sep 27, 1994
3EN ; Entry point from menu option to manually task file room cumulative.
4 W @IOF,!!?20,"Checking File #64.5, LAB REPORTS FILE"
5 D CHECK I LRERR W !!,$C(7),$P(LRERR,U,2),!! G END
6 W !,"File Setup ...OK",!!,"Will schedule report(s):"
7 S LRRPTN=0
8 F S LRRPTN=$O(LRRP(LRRPTN)) Q:'LRRPTN W ?25,$P(LRRP(LRRPTN),U),!
9 K DIR
10 S DIR(0)="YO",DIR("A")="Print Cumulative for FILE ROOM",DIR("B")="NO"
11 S DIR("?")="Answer 'YES' if you want to task the FILE ROOM Cumulative to start."
12 D ^DIR K DIR
13 I Y D
14 . S ZTRTN="CLOCK^LRFAC",ZTIO="",ZTDESC="Start FILE ROOM Cumulative"
15 . D ^%ZTLOAD W !,"Request ",$S($D(ZTSK):"",1:"NOT "),"Queued" W:$D(ZTSK) !,"Task #",ZTSK
16 G END
17 ;
18CLOCK ; Task fileroom patients cumulative to appropiate devices.
19 D CHECK I LRERR D G END
20 . S XQAMSG="File setup problem observed when attempting to run Lab File Room Cumulative"
21 . D ALERT
22 K ^LAC($J),XQAMSG
23 Q:'$D(^LAB(64.5,1,3))!($D(^LAC("LRAC","A")))
24 S CNT=0 F L +^LAB(64.5):1 Q:$T H 60 S CNT=1 I CNT>5 D Q ; Lock LAB REPORTS file.
25 . S XQAMSG="Unable to lock Lab Reports file (#64.5) check Lock Table"
26 . D ALERT
27 G END:$D(XQAMSG)
28 S LRDT=$P(^LAB(64.5,1,0),U,3) ; Get last cumulative report date.
29 S LRLDT=$P($G(^LAB(64.5,1,6)),U,1) I 'LRLDT S LRLDT=LRDT ;Find last fileroom report date ( if none, set to last report date).
30 S LRRE=0,LRXLR="LRAC",LRPERM=0,LRBOT=$P(^LAB(64.5,1,0),U,2)
31 S %DT="",X="T" D ^%DT S LRYDT=Y
32 ; For each day since last fileroom run, move fileroom patients to current fileroom list.
33 ; Start with last file room run date in case last run was incomplete.
34 ; If patient has been printed subsequently - date stored in second piece of ^LAC("LRAC",LRDFN,0) is more recent, then skip.
35 S LRLDT=LRLDT-.1
36 F S LRLDT=$O(^LRO(69,LRLDT)) Q:'LRLDT!(LRLDT'<LRDT) D
37 . S LRLLOC="FILE ROOM" ; Start with locations containing "FILE ROOM", end when doesn't contain "FILE ROOM".
38 . F S LRLLOC=$O(^LRO(69,LRLDT,1,"AR",LRLLOC)) Q:LRLLOC=""!(LRLLOC'["FILE ROOM") D
39 . . S PNM=""
40 . . F S PNM=$O(^LRO(69,LRLDT,1,"AR",LRLLOC,PNM)) Q:PNM="" D
41 . . . S LRDFN=0
42 . . . F S LRDFN=$O(^LRO(69,LRLDT,1,"AR",LRLLOC,PNM,LRDFN)) Q:'LRDFN I LRLDT>$P($G(^LAC("LRAC",LRDFN,0)),U,2) S $P(^LRO(69,LRDT,1,"AR",LRLLOC,PNM,LRDFN),U,2)=$P(^LRO(69,LRLDT,1,"AR",LRLLOC,PNM,LRDFN),U,2)
43 S LRLDT=LRDT,$P(^LAB(64.5,1,6),U,1)=LRLDT ; Update last Fileroom run date.
44 L -^LAB(64.5) ; Release locks.
45 ; Will task those reports that are flagged as separate fileroom.
46 N ZTIO ; Tasked jobs have ZTIO defined, want ZTLOAD to build from IO* variables.
47 S LRRPTN=0
48 F S LRRPTN=$O(^LAB(64.5,1,3,LRRPTN)) Q:'LRRPTN D
49 . S LRX(0)=$G(^LAB(64.5,1,3,LRRPTN,0)),LRX(.1)=$G(^LAB(64.5,1,3,LRRPTN,.1))
50 . I $P(LRX(0),U,2)["FILE ROOM",$P(LRX(0),U,3)["FILE ROOM",$P(LRX(.1),U,3) D
51 . . ; Starting/Ending locations contain "FILE ROOM", flag set to YES for FILEROOM REPORT.
52 . . S IOP=$P(LRX(.1),U,1) Q:IOP="" S %ZIS="N" D ^%ZIS Q:POP ; Get device characteristics.
53 . . F I="LRPERM","LRXLR","LRDT","LRLDT","LRYDT","LRBOT","LRRE","LRRPTN" S ZTSAVE(I)=""
54 . . S ZTRTN="DQ^LRFAC",ZTDTH=$H,ZTDESC="Laboratory Fileroom Cumulative"
55 . . D ^%ZTLOAD K ZTSK ; Task the job.
56 . K IOP D ^%ZISC ; Restore device parameters.
57 G END
58 ;
59DQ ; Queued entry point to actually print fileroom reports
60 S $P(^LAB(64.5,1,3,LRRPTN,0),U,4,8)="" ; Clear previous status for this report.
61 D ENT^LRAC1
62 S:$D(ZTQUEUED) ZTREQ="@"
63 Q
64 ;
65CHECK ; Check File 64.5 for proper setup.
66 N LRRPTN,LRX
67 S LRERR=0,LRX(0)=$G(^LAB(64.5,1,0)),LRX(6)=$G(^LAB(64.5,1,6))
68 I '$P(LRX(0),U,4) S LRERR=1_U_"Field #4, FILE ROOM, not set to 'YES'!" Q
69 I '$P(LRX(6),U,2) S LRERR=2_U_"Field #17, SEPARATE FILE ROOM, not set to 'YES'!" Q
70 S LRRPTN=0 K LRX
71 F S LRRPTN=$O(^LAB(64.5,1,3,LRRPTN)) Q:LRRPTN<1!(LRERR) D
72 . S LRX(0)=$G(^LAB(64.5,1,3,LRRPTN,0)),LRX(.1)=$G(^LAB(64.5,1,3,LRRPTN,.1))
73 . I '$P(LRX(.1),U,3) Q
74 . I $P(LRX(0),U,2)'["FILE ROOM" S LRERR=3 Q
75 . I $P(LRX(0),U,3)'["FILE ROOM" S LRERR=4 Q
76 . S LRRP(LRRPTN)=LRX(0)
77 I LRERR S LRERR=LRERR_U_"Report: "_$P(LRX(0),U)_" - "_$S(LRERR=3:"Starting",1:"Ending")_" Location does NOT contain 'FILE ROOM'!" Q
78 I '$D(LRRP) S LRERR=5_U_"No reports for FILE ROOM found!"
79 Q
80 ;
81END ; Clean up time.
82 S:$D(ZTQUEUED) ZTREQ="@" D ^%ZISC
83 K %DT,%H,%ZIS,DA,DIR,DIRUT,I,PNM,X,X1,X2,Y,Z
84 K LRBOT,LRCVT,LRDFN,LRDT,LREND,LRERR,LRLDT,LRLLOC,LRNM,LRPERM,LRRP,LRRPTN,LRRE,LRX,LRXLR,LRYDT,CNT
85 K XQ1,XQAMSG,XQXFLG
86 Q
87ALERT ;Send Alert Messages to LRLIASON mail group
88 Q:'$L($G(XQAMSG)) N Y S Y=0 F S Y=$O(^XUSEC("LRLIASON",Y)) S XQA(Y)=""
89 I $D(XQA) D SETUP^XQALERT
90 Q
Note: See TracBrowser for help on using the repository browser.