AZXRBUG5 ;BUGDRUG2 Report PROGRAM [ 09/23/94 9:52 AM ]
;Version 1
;"Antibiotic Sensitivities Report"
;09/04/92 JOHN H. LYNCH
;
;ALLOWS THE DATA ENTRY PERSON TO RUN A REPORT
;GIVING INFORMATION ON THE TOTAL NUMBER OF ENTRIES
;IN THE DATABASE FOR A GIVEN FACILITY AND DATE
;RANGE FOR ALL ORGANISM SENSITIVITIES TO DIFFERENT
;DRUGS.
;THE ROUTINES THAT CALL AZXRBUG5:
;AZXRBUG3, Report Menu
;THE ROUTINES THAT AZXRBUG5 CALLS:
;AZXRBUG7, Report Input
;%ZIS= (FILEMAN DEVICE HANDLER)
;Variable List
;PG= Current page count.
;LN= Current line count.
;FACBKUP= Flag returned from AZXRBUG7 with data on
; whether user wants to quit.
;FCLTY= Internal Number of site from SITES file.
;BORDER1= Special border for report.
;BORDER2= Special border for report.
;HEADER= Special header for report.
;%ZIS("B")= Don't use HOME as default device.
;LDATE= Current date used in print loop (REPORT SUB-
; ROUTINE).
;ORG= Current organism used in print loop (REPORT
; SUB-ROUTINE).
;DA= Current internal entry number used in print
; loop (REPORT SUB-ROUTINE).
;Y= Date used for date conversion.
;FDATE= Users starting date input; this value is
; exported from AZXRBUG7.
;TDATE= Users ending date input; this value is
; exported from AZXRBUG7.
;RFDATE= Starting report date in external format.
;RTDATE= Ending report date in external format.
;ORGCHK= Starts as a copy of ORG but ends up in an
; external form of Organism_Name.
;ZERONODE= The current node of BUGDRUG2 which drug
; sensitivities are being extracted.
;FAC= External form of current facility.
;YN= Users input of whether to print another report.
;Variables Used for Drug Sensitivity Calculations
;%AK,%AM,%AUG,%C,%CAX,%CB,%CC,%CF,%CFX,%CP,%CRM,%DP
;%E1,%FM,%GM,%NA,%P,%PI,%SxT,%TE,%TI,%VA
;AK,AM,AUG,C,CAX,CB,CC,CF,CFX,CP,CRM,DP
;E1,FM,GM,NA,P,PI,SxT,TE,TI,VA
MAIN ;AZXRBUG5 PROGRAM CONTROL
;SET LOCAL VARIABLES
S PG=0 ;INITIALIZE PAGE NUMBER
S LN=0 ;INITIALIZE LINE COUNTER
D INITDRG ;INITIALIZE DRUG VARIABLES
D ^AZXRBUG7 ;CALL INPUT ROUTINE
;FOR FACILITY & DATE RANGE
I FACBKUP="Y" Q ;FACBKUP= RETURNED FROM
; ^AZXRBUG7;USER WANTS
; TO QUIT
D REPORT
D CONT
D KILL
Q
REPORT ;SETUP VALUES TO PREPARE FOR REPORT PRINT (RPTPRT)
;SET LOCAL VARIABLES
S BORDER1="______________________________________________________________________________________________________________________"
S BORDER2="_____________________________|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|"
S HEADER="Organism |AK |AM |AUG|C |CAX|CB |CC |CF |CFX|CP |CRM|DP |E |FM |GM |NA |P |PI |SxT|TE |TI |VA |"
S %ZIS("B")="" ;DON'T USE HOME AS DEFAULT
;DEVICE
D ^%ZIS U IO ;OPEN DEVICE
I IO="" Q ;USER WANTS OUT
I IO(0)=IO W !,*7,"This report must be printed.",! G REPORT
D DTCNVRT,HEADING ;PRINT OUT FIRST PAGE HEADING
S ORG="" ;INITIALIZE Organism
F S ORG=$O(^DIZ(1991020,"FOD",FCLTY,ORG)) Q:'ORG S LDATE=FDATE-1 F S LDATE=$O(^DIZ(1991020,"FOD",FCLTY,ORG,LDATE)) D:('LDATE)!(LDATE>TDATE) RPTPRT Q:('LDATE)!(LDATE>TDATE) S DA="" F S DA=$O(^DIZ(1991020,"FOD",FCLTY,ORG,LDATE,DA)) Q:'DA D INCRMNT
;DO SEARCH LOOP
;CALL REPORT PRINT
X ^%ZIS("C") ;CLOSE DEVICE
Q
RPTPRT ;ACTUAL PRINTING OF REPORT DATA
;SETTING DRUG SENSITIVITY PERCENTAGES
I (LN+4)>IOSL D HEADING ;CHECK IF NEW PAGE IS NEEDED
D EXTORG ;CONVERT Organism_Name TO
;EXTERNAL FORMAT
;PRINT Organism_Name
I AK S %AK=((%AK*100)/(AK)) ;SET DRUG SENSITIVITY
I AM S %AM=((%AM*100)/(AM)) ;PERCENTAGES
I AUG S %AUG=((%AUG*100)/(AUG))
I C S %C=((%C*100)/(C))
I CAX S %CAX=((%CAX*100)/(CAX))
I CB S %CB=((%CB*100)/(CB))
I CC S %CC=((%CC*100)/(CC))
I CF S %CF=((%CF*100)/(CF))
I CFX S %CFX=((%CFX*100)/(CFX))
I CP S %CP=((%CP*100)/(CP))
I CRM S %CRM=((%CRM*100)/(CRM))
I DP S %DP=((%DP*100)/(DP))
I E1 S %E1=((%E1*100)/(E1))
I FM S %FM=((%FM*100)/(FM))
I GM S %GM=((%GM*100)/(GM))
I NA S %NA=((%NA*100)/(NA))
I P S %P=((%P*100)/(P))
I PI S %PI=((%PI*100)/(PI))
I SxT S %SxT=((%SxT*100)/(SxT))
I TE S %TE=((%TE*100)/(TE))
I TI S %TI=((%TI*100)/(TI))
I VA S %VA=((%VA*100)/(VA))
;PRINT DRUG SENSITIVITY PERCENTAGES
W ?28,"%|",?30,$J(%AK,3,0),"|",?34,$J(%AM,3,0),"|"
W ?38,$J(%AUG,3,0),"|",?42,$J(%C,3,0),"|",?46,$J(%CAX,3,0),"|"
W ?50,$J(%CB,3,0),"|",?54,$J(%CC,3,0),"|",?58,$J(%CF,3,0),"|"
W ?62,$J(%CFX,3,0),"|",?66,$J(%CP,3,0),"|",?70,$J(%CRM,3,0),"|"
W ?74,$J(%DP,3,0),"|",?78,$J(%E1,3,0),"|",?82,$J(%FM,3,0),"|"
W ?86,$J(%GM,3,0),"|",?90,$J(%NA,3,0),"|",?94,$J(%P,3,0),"|"
W ?98,$J(%PI,3,0),"|",?102,$J(%SxT,3,0),"|",?106,$J(%TE,3,0),"|"
W ?110,$J(%TI,3,0),"|",?114,$J(%VA,3,0),"|",!
;PRINT OUT NUMBER TESTED
W ?28,"#|",?30,$J(AK,3,0),"|",?34,$J(AM,3,0),"|"
W ?38,$J(AUG,3,0),"|",?42,$J(C,3,0),"|",?46,$J(CAX,3,0),"|"
W ?50,$J(CB,3,0),"|",?54,$J(CC,3,0),"|",?58,$J(CF,3,0),"|"
W ?62,$J(CFX,3,0),"|",?66,$J(CP,3,0),"|",?70,$J(CRM,3,0),"|"
W ?74,$J(DP,3,0),"|",?78,$J(E1,3,0),"|",?82,$J(FM,3,0),"|"
W ?86,$J(GM,3,0),"|",?90,$J(NA,3,0),"|",?94,$J(P,3,0),"|"
W ?98,$J(PI,3,0),"|",?102,$J(SxT,3,0),"|",?106,$J(TE,3,0),"|"
W ?110,$J(TI,3,0),"|",?114,$J(VA,3,0),"|",!
;INITIALIZE DRUG VARIABLES
D INITDRG
W BORDER2,!
S LN=LN+4 ;INCREMENT LINE COUNT
Q
DTCNVRT ;CONVERT TDATE & FDATE TO EXTERNAL FORMAT (RTDATE, RFDATE)
S Y=FDATE ;CONVERT TO EXTERNAL DATE
D DD^%DT ;VALUE RETURNED IN Y
S RFDATE=Y ;RFDATE= REPORT DATE
S Y=TDATE ;CONVERT TO EXTERNAL DATE
D DD^%DT ;VALUE RETURNED IN Y
S RTDATE=Y ;RTDATE= REPORT DATE
Q
EXTORG ;CONVERT Organism_Name TO EXTERNAL FORMAT FOR PRINTING
S ORGCHK=ORG ;ORGCHK= Organism_Name
S DIC(0)="NXZ" ;N= INTERNAL NUMBER LOOKUP
;X= EXACT MATCH REQUIRED
;Z= VALUES RETURNED IN Y=N^S
; N= INTERNAL ENTRY NUMBER
; S= VALUE OF .01 FIELD
S DIC="^DIZ(1991018," ;DIC= ORGANISM FILE
S X=ORGCHK ;X= LOOKUP VALUE (ORG)
D ^DIC ;DO FILEMAN LOOKUP
S ORGCHK=$P(^DIZ(1991018,$P(Y,U,1),0),U,1)
;ORGCHK= Organism_Name
W !,$E(ORGCHK,1,27) ;PRINT Organism_Name
Q
INCRMNT ;INCREMENT ALL VARIABLES FOR % SENSITIVE, # TESTED
S ZERONODE=^DIZ(1991020,DA,0) ;ZERONODE= CURRENT ENTRY
;INCREMENT # SENSITIVE & INCREMENT # TESTED
I $P(ZERONODE,U,6)="S" S %AK=%AK+1,AK=AK+1
I $P(ZERONODE,U,6)="R" S AK=AK+1
I $P(ZERONODE,U,8)="S" S %AM=%AM+1,AM=AM+1
I $P(ZERONODE,U,8)="R" S AM=AM+1
I $P(ZERONODE,U,7)="S" S %AUG=%AUG+1,AUG=AUG+1
I $P(ZERONODE,U,7)="R" S AUG=AUG+1
I $P(ZERONODE,U,14)="S" S %C=%C+1,C=C+1
I $P(ZERONODE,U,14)="R" S C=C+1
I $P(ZERONODE,U,11)="S" S %CAX=%CAX+1,CAX=CAX+1
I $P(ZERONODE,U,11)="R" S CAX=CAX+1
I $P(ZERONODE,U,9)="S" S %CB=%CB+1,CB=CB+1
I $P(ZERONODE,U,9)="R" S CB=CB+1
I $P(ZERONODE,U,16)="S" S %CC=%CC+1,CC=CC+1
I $P(ZERONODE,U,16)="R" S CC=CC+1
I $P(ZERONODE,U,13)="S" S %CF=%CF+1,CF=CF+1
I $P(ZERONODE,U,13)="R" S CF=CF+1
I $P(ZERONODE,U,10)="S" S %CFX=%CFX+1,CFX=CFX+1
I $P(ZERONODE,U,10)="R" S CFX=CFX+1
I $P(ZERONODE,U,15)="S" S %CP=%CP+1,CP=CP+1
I $P(ZERONODE,U,15)="R" S CP=CP+1
I $P(ZERONODE,U,12)="S" S %CRM=%CRM+1,CRM=CRM+1
I $P(ZERONODE,U,12)="R" S CRM=CRM+1
I $P(ZERONODE,U,19)="S" S %DP=%DP+1,DP=DP+1
I $P(ZERONODE,U,19)="R" S DP=DP+1
I $P(ZERONODE,U,17)="S" S %E1=%E1+1,E1=E1+1
I $P(ZERONODE,U,17)="R" S E1=E1+1
I $P(ZERONODE,U,21)="S" S %FM=%FM+1,FM=FM+1
I $P(ZERONODE,U,21)="R" S FM=FM+1
I $P(ZERONODE,U,18)="S" S %GM=%GM+1,GM=GM+1
I $P(ZERONODE,U,18)="R" S GM=GM+1
I $P(ZERONODE,U,20)="S" S %NA=%NA+1,NA=NA+1
I $P(ZERONODE,U,20)="R" S NA=NA+1
I $P(ZERONODE,U,22)="S" S %P=%P+1,P=P+1
I $P(ZERONODE,U,22)="R" S P=P+1
I $P(ZERONODE,U,23)="S" S %PI=%PI+1,PI=PI+1
I $P(ZERONODE,U,23)="R" S PI=PI+1
I $P(ZERONODE,U,24)="S" S %SxT=%SxT+1,SxT=SxT+1
I $P(ZERONODE,U,24)="R" S SxT=SxT+1
I $P(ZERONODE,U,25)="S" S %TE=%TE+1,TE=TE+1
I $P(ZERONODE,U,25)="R" S TE=TE+1
I $P(ZERONODE,U,26)="S" S %TI=%TI+1,TI=TI+1
I $P(ZERONODE,U,26)="R" S TI=TI+1
I $P(ZERONODE,U,27)="S" S %VA=%VA+1,VA=VA+1
I $P(ZERONODE,U,27)="R" S VA=VA+1
Q
HEADING ;PRINT OUT THE HEADING FOR EACH NEW PAGE
I PG>0 W # ;SEND FORMFEED
S PG=PG+1 ;INCREMENT PAGE COUNTER
W !,BORDER1,!
W !,"BugDrug2 Antibiotic Sensitivity"
W ?64,"From Date: ",RFDATE,?91,"--",?97,"To Date: ",RTDATE
W !!,"Facility: ",FAC,?100,"Page: ",PG
W !,BORDER1
W !!,HEADER
W !,BORDER2,!
S LN=10 ;INITIALIZE LINE COUNTER
;HEADER USES 10 LINES
Q
INITDRG ;INITIALIZE THE DRUG VARIABLES
S %AK=0,%AM=0,%AUG=0,%C=0,%CAX=0,%CB=0,%CC=0,%CF=0,%CFX=0
S %CP=0,%CRM=0,%DP=0,%E1=0,%FM=0,%GM=0,%NA=0,%P=0,%PI=0
S %SxT=0,%TE=0,%TI=0,%VA=0
S AK=0,AM=0,AUG=0,C=0,CAX=0,CB=0,CC=0,CF=0,CFX=0
S CP=0,CRM=0,DP=0,E1=0,FM=0,GM=0,NA=0,P=0,PI=0
S SxT=0,TE=0,TI=0,VA=0
;INITIALIZE DRUG VARIABLES
Q
CONT ;ASK USER WHETHER TO CONTINUE WITH REPORT PRINT
;SET LOCAL VARIABLES
S PG=0 ;INITIALIZE PAGE COUNTER
S LN=0 ;INITIALIZE LINE COUNTER
D INITDRG ;INITIALIZE DRUG VARIABLES
W !!!!!!!,"Do you want to print another"
R " 'Antibiotic Sensitivity' report? N//",YN
;ASK USER WHETHER TO CONTINUE?
I YN?1.3"?" W !!,"Answer with: Y= Yes, N= No" G CONT
;USER WANTS HELP
I (YN?1"Y")!(YN?1"y")!(YN?1"YES")!(YN?1"yes") D ^AZXRBUG7 I FACBKUP="N" D REPORT G CONT
;FACBKUP= RETURNED FROM
; ^AZXRBUG7;USER WANTS
; TO QUIT
Q
KILL ;KILL LOCAL VARIABLES AND EXIT ROUTINE AZXRBUG5
K PG,LN,FACBKUP,BORDER1,BORDER2,HEADER,%ZIS
K LDATE,FCLTY,ORG,DA,%AK,AK,%AM,AM,%AUG,AUG
K %C,C,%CAX,CAX,%CB,CB,%CC,CC,%CF,CF
K %CFX,CFX,%CP,CP,%CRM,CRM,%DP,DP,%E1,E1
K %FM,FM,%GM,GM,%NA,NA,%P,P,%PI,PI
K %SxT,SxT,%TE,TE,%TI,TI,%VA,VA,Y,FDATE,TDATE
K RFDATE,ORGCHK,DIC,ZERONODE,FAC,YN
Q
AZXRBUG5 ;BUGDRUG2 Report PROGRAM [ 09/23/94 9:52 AM ]
+1 ;Version 1
+2 ;"Antibiotic Sensitivities Report"
+3 ;09/04/92 JOHN H. LYNCH
+4 ;
+5 ;ALLOWS THE DATA ENTRY PERSON TO RUN A REPORT
+6 ;GIVING INFORMATION ON THE TOTAL NUMBER OF ENTRIES
+7 ;IN THE DATABASE FOR A GIVEN FACILITY AND DATE
+8 ;RANGE FOR ALL ORGANISM SENSITIVITIES TO DIFFERENT
+9 ;DRUGS.
+10 +11 ;THE ROUTINES THAT CALL AZXRBUG5:
+12 ;AZXRBUG3, Report Menu
+13 +14 ;THE ROUTINES THAT AZXRBUG5 CALLS:
+15 ;AZXRBUG7, Report Input
+16 ;%ZIS= (FILEMAN DEVICE HANDLER)
+17 +18 ;Variable List
+19 ;PG= Current page count.
+20 ;LN= Current line count.
+21 ;FACBKUP= Flag returned from AZXRBUG7 with data on
+22 ; whether user wants to quit.
+23 ;FCLTY= Internal Number of site from SITES file.
+24 ;BORDER1= Special border for report.
+25 ;BORDER2= Special border for report.
+26 ;HEADER= Special header for report.
+27 ;%ZIS("B")= Don't use HOME as default device.
+28 ;LDATE= Current date used in print loop (REPORT SUB-
+29 ; ROUTINE).
+30 ;ORG= Current organism used in print loop (REPORT
+31 ; SUB-ROUTINE).
+32 ;DA= Current internal entry number used in print
+33 ; loop (REPORT SUB-ROUTINE).
+34 ;Y= Date used for date conversion.
+35 ;FDATE= Users starting date input; this value is
+36 ; exported from AZXRBUG7.
+37 ;TDATE= Users ending date input; this value is
+38 ; exported from AZXRBUG7.
+39 ;RFDATE= Starting report date in external format.
+40 ;RTDATE= Ending report date in external format.
+41 ;ORGCHK= Starts as a copy of ORG but ends up in an
+42 ; external form of Organism_Name.
+43 ;ZERONODE= The current node of BUGDRUG2 which drug
+44 ; sensitivities are being extracted.
+45 ;FAC= External form of current facility.
+46 ;YN= Users input of whether to print another report.
+47 +48 ;Variables Used for Drug Sensitivity Calculations
+49 ;%AK,%AM,%AUG,%C,%CAX,%CB,%CC,%CF,%CFX,%CP,%CRM,%DP
+50 ;%E1,%FM,%GM,%NA,%P,%PI,%SxT,%TE,%TI,%VA
+51 +52 ;AK,AM,AUG,C,CAX,CB,CC,CF,CFX,CP,CRM,DP
+53 ;E1,FM,GM,NA,P,PI,SxT,TE,TI,VA
+54 MAIN ;AZXRBUG5 PROGRAM CONTROL
+1 ;SET LOCAL VARIABLES
+2 ;INITIALIZE PAGE NUMBER
SET PG=0
+3 ;INITIALIZE LINE COUNTER
SET LN=0
+4 ;INITIALIZE DRUG VARIABLES
DO INITDRG
+5 +6 ;CALL INPUT ROUTINE
DO ^AZXRBUG7
+7 ;FOR FACILITY & DATE RANGE
+8 +9 ;FACBKUP= RETURNED FROM
IF FACBKUP="Y"
QUIT
+10 ; ^AZXRBUG7;USER WANTS
+11 ; TO QUIT
+12 +13 DO REPORT
+14 DO CONT
+15 DO KILL
+16 QUIT
+17 REPORT ;SETUP VALUES TO PREPARE FOR REPORT PRINT (RPTPRT)
+1 ;SET LOCAL VARIABLES
+2 SET BORDER1="______________________________________________________________________________________________________________________"
+3 SET BORDER2="_____________________________|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|"
+4 SET HEADER="Organism |AK |AM |AUG|C |CAX|CB |CC |CF |CFX|CP |CRM|DP |E |FM |GM |NA |P |PI |SxT|TE |TI |VA |"
+5 ;DON'T USE HOME AS DEFAULT
SET %ZIS("B")=""
+6 ;DEVICE
+7 +8 ;OPEN DEVICE
DO ^%ZIS
USE IO
+9 +10 ;USER WANTS OUT
IF IO=""
QUIT
+11 IF IO(0)=IO
WRITE !,*7,"This report must be printed.",!
GOTO REPORT
+12 ;PRINT OUT FIRST PAGE HEADING
DO DTCNVRT
DO HEADING
+13 +14 ;INITIALIZE Organism
SET ORG=""
+15 FOR
SET ORG=$ORDER(^DIZ(1991020,"FOD",FCLTY,ORG))
IF 'ORG
QUIT
SET LDATE=FDATE-1
FOR
SET LDATE=$ORDER(^DIZ(1991020,"FOD",FCLTY,ORG,LDATE))
IF ('LDATE)!(LDATE>TDATE)
DO RPTPRT
IF ('LDATE)!(LDATE>TDATE)
QUIT
SET DA=""
FOR
SET DA=$ORDER(^DIZ(1991020,"FOD",FCLTY,ORG,LDATE,DA))
IF 'DA
QUIT
DO INCRMNT
+16 ;DO SEARCH LOOP
+17 ;CALL REPORT PRINT
+18 +19 ;CLOSE DEVICE
XECUTE ^%ZIS("C")
+20 QUIT
+21 RPTPRT ;ACTUAL PRINTING OF REPORT DATA
+1 ;SETTING DRUG SENSITIVITY PERCENTAGES
+2 +3 ;CHECK IF NEW PAGE IS NEEDED
IF (LN+4)>IOSL
DO HEADING
+4 +5 ;CONVERT Organism_Name TO
DO EXTORG
+6 ;EXTERNAL FORMAT
+7 ;PRINT Organism_Name
+8 ;SET DRUG SENSITIVITY
IF AK
SET %AK=((%AK*100)/(AK))
+9 ;PERCENTAGES
IF AM
SET %AM=((%AM*100)/(AM))
+10 IF AUG
SET %AUG=((%AUG*100)/(AUG))
+11 IF C
SET %C=((%C*100)/(C))
+12 IF CAX
SET %CAX=((%CAX*100)/(CAX))
+13 IF CB
SET %CB=((%CB*100)/(CB))
+14 IF CC
SET %CC=((%CC*100)/(CC))
+15 IF CF
SET %CF=((%CF*100)/(CF))
+16 IF CFX
SET %CFX=((%CFX*100)/(CFX))
+17 IF CP
SET %CP=((%CP*100)/(CP))
+18 IF CRM
SET %CRM=((%CRM*100)/(CRM))
+19 IF DP
SET %DP=((%DP*100)/(DP))
+20 IF E1
SET %E1=((%E1*100)/(E1))
+21 IF FM
SET %FM=((%FM*100)/(FM))
+22 IF GM
SET %GM=((%GM*100)/(GM))
+23 IF NA
SET %NA=((%NA*100)/(NA))
+24 IF P
SET %P=((%P*100)/(P))
+25 IF PI
SET %PI=((%PI*100)/(PI))
+26 IF SxT
SET %SxT=((%SxT*100)/(SxT))
+27 IF TE
SET %TE=((%TE*100)/(TE))
+28 IF TI
SET %TI=((%TI*100)/(TI))
+29 IF VA
SET %VA=((%VA*100)/(VA))
+30 +31 ;PRINT DRUG SENSITIVITY PERCENTAGES
+32 WRITE ?28,"%|",?30,$JUSTIFY(%AK,3,0),"|",?34,$JUSTIFY(%AM,3,0),"|"
+33 WRITE ?38,$JUSTIFY(%AUG,3,0),"|",?42,$JUSTIFY(%C,3,0),"|",?46,$JUSTIFY(%CAX,3,0),"|"
+34 WRITE ?50,$JUSTIFY(%CB,3,0),"|",?54,$JUSTIFY(%CC,3,0),"|",?58,$JUSTIFY(%CF,3,0),"|"
+35 WRITE ?62,$JUSTIFY(%CFX,3,0),"|",?66,$JUSTIFY(%CP,3,0),"|",?70,$JUSTIFY(%CRM,3,0),"|"
+36 WRITE ?74,$JUSTIFY(%DP,3,0),"|",?78,$JUSTIFY(%E1,3,0),"|",?82,$JUSTIFY(%FM,3,0),"|"
+37 WRITE ?86,$JUSTIFY(%GM,3,0),"|",?90,$JUSTIFY(%NA,3,0),"|",?94,$JUSTIFY(%P,3,0),"|"
+38 WRITE ?98,$JUSTIFY(%PI,3,0),"|",?102,$JUSTIFY(%SxT,3,0),"|",?106,$JUSTIFY(%TE,3,0),"|"
+39 WRITE ?110,$JUSTIFY(%TI,3,0),"|",?114,$JUSTIFY(%VA,3,0),"|",!
+40 +41 ;PRINT OUT NUMBER TESTED
+42 WRITE ?28,"#|",?30,$JUSTIFY(AK,3,0),"|",?34,$JUSTIFY(AM,3,0),"|"
+43 WRITE ?38,$JUSTIFY(AUG,3,0),"|",?42,$JUSTIFY(C,3,0),"|",?46,$JUSTIFY(CAX,3,0),"|"
+44 WRITE ?50,$JUSTIFY(CB,3,0),"|",?54,$JUSTIFY(CC,3,0),"|",?58,$JUSTIFY(CF,3,0),"|"
+45 WRITE ?62,$JUSTIFY(CFX,3,0),"|",?66,$JUSTIFY(CP,3,0),"|",?70,$JUSTIFY(CRM,3,0),"|"
+46 WRITE ?74,$JUSTIFY(DP,3,0),"|",?78,$JUSTIFY(E1,3,0),"|",?82,$JUSTIFY(FM,3,0),"|"
+47 WRITE ?86,$JUSTIFY(GM,3,0),"|",?90,$JUSTIFY(NA,3,0),"|",?94,$JUSTIFY(P,3,0),"|"
+48 WRITE ?98,$JUSTIFY(PI,3,0),"|",?102,$JUSTIFY(SxT,3,0),"|",?106,$JUSTIFY(TE,3,0),"|"
+49 WRITE ?110,$JUSTIFY(TI,3,0),"|",?114,$JUSTIFY(VA,3,0),"|",!
+50 +51 ;INITIALIZE DRUG VARIABLES
+52 DO INITDRG
+53 +54 WRITE BORDER2,!
+55 ;INCREMENT LINE COUNT
SET LN=LN+4
+56 QUIT
+57 DTCNVRT ;CONVERT TDATE & FDATE TO EXTERNAL FORMAT (RTDATE, RFDATE)
+1 ;CONVERT TO EXTERNAL DATE
SET Y=FDATE
+2 ;VALUE RETURNED IN Y
DO DD^%DT
+3 ;RFDATE= REPORT DATE
SET RFDATE=Y
+4 +5 ;CONVERT TO EXTERNAL DATE
SET Y=TDATE
+6 ;VALUE RETURNED IN Y
DO DD^%DT
+7 ;RTDATE= REPORT DATE
SET RTDATE=Y
+8 QUIT
+9 EXTORG ;CONVERT Organism_Name TO EXTERNAL FORMAT FOR PRINTING
+1 ;ORGCHK= Organism_Name
SET ORGCHK=ORG
+2 ;N= INTERNAL NUMBER LOOKUP
SET DIC(0)="NXZ"
+3 ;X= EXACT MATCH REQUIRED
+4 ;Z= VALUES RETURNED IN Y=N^S
+5 ; N= INTERNAL ENTRY NUMBER
+6 ; S= VALUE OF .01 FIELD
+7 +8 ;DIC= ORGANISM FILE
SET DIC="^DIZ(1991018,"
+9 ;X= LOOKUP VALUE (ORG)
SET X=ORGCHK
+10 ;DO FILEMAN LOOKUP
DO ^DIC
+11 SET ORGCHK=$PIECE(^DIZ(1991018,$PIECE(Y,U,1),0),U,1)
+12 ;ORGCHK= Organism_Name
+13 ;PRINT Organism_Name
WRITE !,$EXTRACT(ORGCHK,1,27)
+14 QUIT
+15 INCRMNT ;INCREMENT ALL VARIABLES FOR % SENSITIVE, # TESTED
+1 ;ZERONODE= CURRENT ENTRY
SET ZERONODE=^DIZ(1991020,DA,0)
+2 +3 ;INCREMENT # SENSITIVE & INCREMENT # TESTED
+4 IF $PIECE(ZERONODE,U,6)="S"
SET %AK=%AK+1
SET AK=AK+1
+5 IF $PIECE(ZERONODE,U,6)="R"
SET AK=AK+1
+6 IF $PIECE(ZERONODE,U,8)="S"
SET %AM=%AM+1
SET AM=AM+1
+7 IF $PIECE(ZERONODE,U,8)="R"
SET AM=AM+1
+8 IF $PIECE(ZERONODE,U,7)="S"
SET %AUG=%AUG+1
SET AUG=AUG+1
+9 IF $PIECE(ZERONODE,U,7)="R"
SET AUG=AUG+1
+10 IF $PIECE(ZERONODE,U,14)="S"
SET %C=%C+1
SET C=C+1
+11 IF $PIECE(ZERONODE,U,14)="R"
SET C=C+1
+12 IF $PIECE(ZERONODE,U,11)="S"
SET %CAX=%CAX+1
SET CAX=CAX+1
+13 IF $PIECE(ZERONODE,U,11)="R"
SET CAX=CAX+1
+14 IF $PIECE(ZERONODE,U,9)="S"
SET %CB=%CB+1
SET CB=CB+1
+15 IF $PIECE(ZERONODE,U,9)="R"
SET CB=CB+1
+16 IF $PIECE(ZERONODE,U,16)="S"
SET %CC=%CC+1
SET CC=CC+1
+17 IF $PIECE(ZERONODE,U,16)="R"
SET CC=CC+1
+18 IF $PIECE(ZERONODE,U,13)="S"
SET %CF=%CF+1
SET CF=CF+1
+19 IF $PIECE(ZERONODE,U,13)="R"
SET CF=CF+1
+20 IF $PIECE(ZERONODE,U,10)="S"
SET %CFX=%CFX+1
SET CFX=CFX+1
+21 IF $PIECE(ZERONODE,U,10)="R"
SET CFX=CFX+1
+22 IF $PIECE(ZERONODE,U,15)="S"
SET %CP=%CP+1
SET CP=CP+1
+23 IF $PIECE(ZERONODE,U,15)="R"
SET CP=CP+1
+24 IF $PIECE(ZERONODE,U,12)="S"
SET %CRM=%CRM+1
SET CRM=CRM+1
+25 IF $PIECE(ZERONODE,U,12)="R"
SET CRM=CRM+1
+26 IF $PIECE(ZERONODE,U,19)="S"
SET %DP=%DP+1
SET DP=DP+1
+27 IF $PIECE(ZERONODE,U,19)="R"
SET DP=DP+1
+28 IF $PIECE(ZERONODE,U,17)="S"
SET %E1=%E1+1
SET E1=E1+1
+29 IF $PIECE(ZERONODE,U,17)="R"
SET E1=E1+1
+30 IF $PIECE(ZERONODE,U,21)="S"
SET %FM=%FM+1
SET FM=FM+1
+31 IF $PIECE(ZERONODE,U,21)="R"
SET FM=FM+1
+32 IF $PIECE(ZERONODE,U,18)="S"
SET %GM=%GM+1
SET GM=GM+1
+33 IF $PIECE(ZERONODE,U,18)="R"
SET GM=GM+1
+34 IF $PIECE(ZERONODE,U,20)="S"
SET %NA=%NA+1
SET NA=NA+1
+35 IF $PIECE(ZERONODE,U,20)="R"
SET NA=NA+1
+36 IF $PIECE(ZERONODE,U,22)="S"
SET %P=%P+1
SET P=P+1
+37 IF $PIECE(ZERONODE,U,22)="R"
SET P=P+1
+38 IF $PIECE(ZERONODE,U,23)="S"
SET %PI=%PI+1
SET PI=PI+1
+39 IF $PIECE(ZERONODE,U,23)="R"
SET PI=PI+1
+40 IF $PIECE(ZERONODE,U,24)="S"
SET %SxT=%SxT+1
SET SxT=SxT+1
+41 IF $PIECE(ZERONODE,U,24)="R"
SET SxT=SxT+1
+42 IF $PIECE(ZERONODE,U,25)="S"
SET %TE=%TE+1
SET TE=TE+1
+43 IF $PIECE(ZERONODE,U,25)="R"
SET TE=TE+1
+44 IF $PIECE(ZERONODE,U,26)="S"
SET %TI=%TI+1
SET TI=TI+1
+45 IF $PIECE(ZERONODE,U,26)="R"
SET TI=TI+1
+46 IF $PIECE(ZERONODE,U,27)="S"
SET %VA=%VA+1
SET VA=VA+1
+47 IF $PIECE(ZERONODE,U,27)="R"
SET VA=VA+1
+48 QUIT
+49 HEADING ;PRINT OUT THE HEADING FOR EACH NEW PAGE
+1 +2 ;SEND FORMFEED
IF PG>0
WRITE #
+3 ;INCREMENT PAGE COUNTER
SET PG=PG+1
+4 +5 WRITE !,BORDER1,!
+6 WRITE !,"BugDrug2 Antibiotic Sensitivity"
+7 WRITE ?64,"From Date: ",RFDATE,?91,"--",?97,"To Date: ",RTDATE
+8 WRITE !!,"Facility: ",FAC,?100,"Page: ",PG
+9 WRITE !,BORDER1
+10 WRITE !!,HEADER
+11 WRITE !,BORDER2,!
+12 +13 ;INITIALIZE LINE COUNTER
SET LN=10
+14 ;HEADER USES 10 LINES
+15 QUIT
+16 INITDRG ;INITIALIZE THE DRUG VARIABLES
+1 SET %AK=0
SET %AM=0
SET %AUG=0
SET %C=0
SET %CAX=0
SET %CB=0
SET %CC=0
SET %CF=0
SET %CFX=0
+2 SET %CP=0
SET %CRM=0
SET %DP=0
SET %E1=0
SET %FM=0
SET %GM=0
SET %NA=0
SET %P=0
SET %PI=0
+3 SET %SxT=0
SET %TE=0
SET %TI=0
SET %VA=0
+4 SET AK=0
SET AM=0
SET AUG=0
SET C=0
SET CAX=0
SET CB=0
SET CC=0
SET CF=0
SET CFX=0
+5 SET CP=0
SET CRM=0
SET DP=0
SET E1=0
SET FM=0
SET GM=0
SET NA=0
SET P=0
SET PI=0
+6 SET SxT=0
SET TE=0
SET TI=0
SET VA=0
+7 ;INITIALIZE DRUG VARIABLES
+8 QUIT
+9 CONT ;ASK USER WHETHER TO CONTINUE WITH REPORT PRINT
+1 ;SET LOCAL VARIABLES
+2 ;INITIALIZE PAGE COUNTER
SET PG=0
+3 ;INITIALIZE LINE COUNTER
SET LN=0
+4 ;INITIALIZE DRUG VARIABLES
DO INITDRG
+5 +6 WRITE !!!!!!!,"Do you want to print another"
+7 READ " 'Antibiotic Sensitivity' report? N//",YN
+8 ;ASK USER WHETHER TO CONTINUE?
+9 +10 IF YN?1.3"?"
WRITE !!,"Answer with: Y= Yes, N= No"
GOTO CONT
+11 ;USER WANTS HELP
+12 IF (YN?1"Y")!(YN?1"y")!(YN?1"YES")!(YN?1"yes")
DO ^AZXRBUG7
IF FACBKUP="N"
DO REPORT
GOTO CONT
+13 ;FACBKUP= RETURNED FROM
+14 ; ^AZXRBUG7;USER WANTS
+15 ; TO QUIT
+16 QUIT
+17 KILL ;KILL LOCAL VARIABLES AND EXIT ROUTINE AZXRBUG5
+1 KILL PG,LN,FACBKUP,BORDER1,BORDER2,HEADER,%ZIS
+2 KILL LDATE,FCLTY,ORG,DA,%AK,AK,%AM,AM,%AUG,AUG
+3 KILL %C,C,%CAX,CAX,%CB,CB,%CC,CC,%CF,CF
+4 KILL %CFX,CFX,%CP,CP,%CRM,CRM,%DP,DP,%E1,E1
+5 KILL %FM,FM,%GM,GM,%NA,NA,%P,P,%PI,PI
+6 KILL %SxT,SxT,%TE,TE,%TI,TI,%VA,VA,Y,FDATE,TDATE
+7 KILL RFDATE,ORGCHK,DIC,ZERONODE,FAC,YN
+8 QUIT