source: WorldVistAEHR/trunk/r/AUTOMATED_INFO_COLLECTION_SYS-IBD/IBDF1A.m@ 623

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

initial load of WorldVistAEHR

File size: 3.4 KB
Line 
1IBDF1A ;ALB/CJM - ENCOUNTER FORM (prints for a single patient);NOV 16,1992
2 ;;3.0;AUTOMATED INFO COLLECTION SYS;**29**;APR 24, 1997
3MAIN(WITHDATA) ;
4 ; -- prints encounter forms, either with patient data for a patient
5 ; with no appointment (in which case it uses time of printing as
6 ; the appointment time) or without patient data (only if a form
7 ; is defined for the clinic for such use)
8 ; $G(WITDATA) if the form should be printed with data
9 ; 0 if a blank form for use without patient data should be printed
10 ;
11 N IBF,FORMS,NODE,IBPM
12 ;FORMS = list of forms in form^form^... format
13 ;IBI is a counter used to parse FORMS
14 ;IBPM=1 if forms defined in print manager should be printed
15 N IBFLAG
16 S IBFLAG=1
17 S WITHDATA=+$G(WITHDATA)
18 K ^TMP("IB",$J),^TMP("IBDF",$J)
19 S (IBPM,IBQUIT)=0,DFN=""
20 D CLINIC G:IBQUIT EXIT
21 I WITHDATA D G:IBQUIT EXIT
22 .D PATIENT Q:IBQUIT
23 .D NOW
24 .D WHCHFORM
25 I 'WITHDATA D FORM G:IBQUIT EXIT
26 D DEVICE G:IBQUIT EXIT
27QUEUED ;
28 ;input - DFN,IBAPPT,IBCLINIC
29 N IBDEVICE
30 ;
31 D DEVICE^IBDFUA(0,.IBDEVICE)
32 F IBF=1:1 S IBFORM=$P(FORMS,"^",IBF) Q:'IBFORM D DRWFORM^IBDF2A(IBFORM,WITHDATA,.IBDEVICE)
33 I WITHDATA,IBPM D PRNTOTHR^IBDF1B5(IBCLINIC,IBAPPT,DFN)
34EXIT ;
35 I $D(ZTQUEUED) S ZTREQ="@"
36 E D ^%ZISC
37 D KPRNTVAR^IBDFUA ;kills the screen and graphics parameters
38 K IBQUIT,IBFORM,IBCLINIC,DFN,IBAPPT,IBTYPE,X,Y,I,^TMP("IB",$J),^TMP("IBDF",$J),^TMP("DFN",$J),^TMP("RPT",$J)
39 Q
40FORM ;gets the type of form to print from the clinic setup - sets FORMS
41 N SETUP
42 S SETUP=$O(^SD(409.95,"B",IBCLINIC,"")) I 'SETUP D ERROR S IBQUIT=1 Q
43 S SETUP=$G(^SD(409.95,SETUP,0)) I SETUP="" D ERROR S IBQUIT=1 Q
44 S FORMS=$P(SETUP,"^",5) I 'FORMS D ERROR S IBQUIT=1 Q
45 Q
46ERROR ;prints a message
47 W !!,"There is no encounter form defined for this clinic that should print",!,"without patient data!",!
48 Q
49ERROR2 ;prints a message
50 W !!,"There are no forms defined to print for this clinic!",!
51 Q
52PATIENT ;gets the patient to print the form for
53 S DIR(0)="P^2:EM",DIR("A")="PATIENT NAME" D ^DIR K DIR I $D(DIRUT)!(+Y<1)!('(+Y)) S IBQUIT=1 Q
54 S DFN=+Y
55 Q
56DEVICE ;
57 I $D(ZTQUEUED) Q
58 W !,$C(7),"** Encounter Forms require a page size of 80 lines and 132 columns. **"
59 K %IS,%ZIS,IOP S %ZIS="MQ" D ^%ZIS I POP S IBQUIT=1 Q
60 I $D(IO("Q")) D
61 .S ZTRTN="QUEUED^IBDF1A",(ZTSAVE("WITHDATA"),ZTSAVE("IB*"),ZTSAVE("DFN"),ZTSAVE("FORMS"))=""
62 .S ZTDESC="IBD - PRINT ENCOUNTER FORM" D ^%ZTLOAD
63 .W !,$S($D(ZTSK):"REQUEST QUEUED TASK="_ZTSK,1:"REQUEST CANCELLED")
64 .D HOME^%ZIS S IBQUIT=1 Q
65 U IO
66 Q
67CLINIC ;asks the user for the clinic
68 K DA,DIR S DIR(0)="409.95,.01O",DIR("A")="PRINT AN ENCOUNTER FORM FOR WHICH CLINIC? " D ^DIR K DIR,DA I $D(DTOUT)!$D(DUOUT)!(+Y<0)!('(+Y)) S IBQUIT=1 Q
69 S IBCLINIC=+Y
70 Q
71NOW ;sets IBAPPT to NOW
72 N %,%H,%I,X
73 D NOW^%DTC
74 S IBAPPT=%
75 Q
76WHCHFORM ;
77 I 'IBCLINIC D ASKFORM Q
78 K DIR S DIR(0)="S^1:SELECT ANY FORM;2:USE CLINIC SETUP;",DIR("A")="Do you want to Select a form or Use the form(s) defined by the clinic setup?" D ^DIR K DIR I $D(DIRUT)!(+Y<0) S IBQUIT=1 Q
79 S IBPM=0,FORMS=""
80 I Y=1 D Q:IBQUIT
81 .D ASKFORM
82 E I Y=2 S FORMS=$$FORMS^IBDF1B2(IBCLINIC,DFN,IBAPPT),IBPM=1
83 I '$P(FORMS,"^"),IBPM,'$$IFOTHR^IBDF1B5(IBCLINIC,"FOR EVERY APPOINTMENT"),'$$IFOTHR^IBDF1B5(IBCLINIC,"ONLY FOR EARLIEST APPOINTMENT") D ERROR2 S IBQUIT=1 Q
84 Q
85ASKFORM ;asks to select single form
86 K DIC S DIC("S")="I '$P(^(0),U,7)",DIC=357,DIC(0)="AEQ",DIC("A")="Enter form to print: "
87 D ^DIC K DIC I ($D(DTOUT)!$D(DUOUT)!(+Y<0)) S IBQUIT=1 Q
88 S FORMS=+Y
89 Q
Note: See TracBrowser for help on using the repository browser.