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

QAMPBMW0.m

Go to the documentation of this file.
QAMPBMW0 ;HISC/DAD-BUILD A MONITOR WORKSHEET ;4/26/93  13:36
 ;;1.0;Clinical Monitoring System;;09/13/1993
 K DIR S DIR(0)="NAO^1:10:0"
 S DIR("A")="How many worksheets do you want? ",DIR("B")=1
 S DIR("?",1)="Enter the number of monitor worksheets you want printed."
 S DIR("?")="You may request up to 10 worksheets."
 W ! D ^DIR G:$D(DIRUT) EXIT S QAOSCOPY=Y
 K %ZIS,IOP S %ZIS="QM" W ! D ^%ZIS G:POP EXIT
 I $D(IO("Q")) D  G EXIT
 . K IO("Q")
 . S ZTRTN="ENTSK^QAMPBMW0",ZTDTH=$H,ZTSAVE("QAOSCOPY")=""
 . S ZTDESC="Build a monitor worksheet"
 . D ^%ZTLOAD
 .Q
ENTSK ;
 U IO
 F QAOSCPY=1:1:QAOSCOPY D ^QAMPBMW1 Q:QAOSQUIT  W:QAOSCOPY-QAOSCPY @IOF
EXIT ;
 W ! D ^%ZISC
 K %ZIS,DIR,DIRUT,POP,QA,QAOSCOPY,QAOSCPY,QAOSD0,QAOSFILE,QAOSMID
 K QAOSNUM,QAOSQUIT,QAOSTAB,QAOSTEXT,QAOSTOP,UNDL,X,Y,ZTDESC,ZTDTH
 K ZTRTN,ZTSAVE
 Q
 ;
EN(QAOSFILE) ; Print the contents of file QAOSFILE in 2 sorted columns
 N QA,QAOSD0,QAOSQUIT,QAOSTAB,QAOSTEXT,QAOSTOP,X
 S X=$$MIDDLE(QAOSFILE)
 S QAOSTEXT(1)=0,QAOSTOP(1)=$P(X,"^")
 S QAOSTEXT(2)=$P(X,"^",2),QAOSTOP(2)=""
 S QAOSTAB=0 K QAOSD0
 F  Q:(QAOSTEXT(1)=QAOSTOP(1))&(QAOSTEXT(2)=QAOSTOP(2))  F QA=1,2 D
 . I QAOSTEXT(QA)'=QAOSTOP(QA) S QAOSQUIT=0 F  D  Q:QAOSQUIT
 .. I $G(QAOSD0(QA))="" S QAOSTEXT(QA)=$O(@(QAOSFILE_"""B"",QAOSTEXT(QA))"))
 .. I QAOSTEXT(QA)=QAOSTOP(QA) S QAOSQUIT=1 Q
 .. S QAOSD0(QA)=$O(@(QAOSFILE_"""B"",QAOSTEXT(QA),$G(QAOSD0(QA)))"))
 .. Q:QAOSD0(QA)'>0
 .. Q:$G(@(QAOSFILE_"""B"",QAOSTEXT(QA),+QAOSD0(QA))"))=1
 .. S X=$P($G(@(QAOSFILE_"+QAOSD0(QA),0)")),"^") Q:X=""
 .. W:'QAOSTAB ! W ?QAOSTAB,"___  ",$E(X,1,35)
 .. S QAOSTAB=QAOSTAB+$S('QAOSTAB:40,1:-40),QAOSQUIT=1
 .. Q
 . Q
 Q
 ;
MIDDLE(QAOSFILE) ; Return text of middle entry in B xref
 N QAOSD0,QAOSMID,QAOSNUM,QAOSQUIT,QAOSTEXT
 S QAOSNUM=$P(@(QAOSFILE_"0)"),"^",4)
 S (QAOSTEXT,QAOSTEXT(0))="",(QAOSQUIT,QAOSMID)=0
 I QAOSNUM>1 S QAOSNUM=QAOSNUM#2+QAOSNUM\2 D
 . F  S QAOSTEXT(0)=QAOSTEXT,QAOSTEXT=$O(@(QAOSFILE_"""B"",QAOSTEXT)")) Q:QAOSTEXT=""!QAOSQUIT  D
 .. F QAOSD0=0:0 S QAOSD0=$O(@(QAOSFILE_"""B"",QAOSTEXT,QAOSD0)")) Q:QAOSD0'>0  S QAOSMID=QAOSMID+1 I QAOSMID=QAOSNUM S QAOSQUIT=1 Q
 .. Q
 . Q
 Q QAOSTEXT_"^"_QAOSTEXT(0)