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

RABAR.m

Go to the documentation of this file.
  1. RABAR ;HISC/GJC-Procedure & CPT Code barcode output (part 1 of 2) ;7/31/96 08:57
  1. ;;5.0;Radiology/Nuclear Medicine;;Mar 16, 1998
  1. EN1 ; Entry point for RA BARPROCPRINT (Barcoded Procedure List)
  1. ; variable list:
  1. ; 'RADIC' : namespaced DIC input variables passed to EN1^RASELCT
  1. ; 'RAPRNT': data elements to print i.e, CPT Code, Procedure or both
  1. ; 'RASORT': data elements to sort by i.e, CPT Code or Procedure
  1. ; '^TMP($J,"RA I-TYPE")': Imaging Type(s) selected by the user
  1. ; '^TMP($J,"RA PROC")' : Procedure(s) selected by the user
  1. ;
  1. K ^TMP($J,"RA BARDEV"),^TMP($J,"RA I-TYPE"),^TMP($J,"RA PROC")
  1. N RADIC,RADT,RADX,RADY,RAPRNT,RASORT,RAVHI,RAXIT
  1. S RADT=$$FMTE^XLFDT(DT,"1D"),RAXIT=0
  1. S RATEST=$$TEST^RABAR1() I RATEST<0 D KILL Q
  1. I RATEST D DEV ; obtain proc test print
  1. K RATEST
  1. S RAVHI=$$HI() ; vertical height (in lines) of the barcode
  1. I RAVHI<0 D KILL Q
  1. D KILLDIR S DIR(0)="SO^C:CPT barcode;P:Procedure barcode;B:Both barcodes"
  1. S DIR("A")="Which of the above would you like to print?"
  1. S DIR("?",1)="Enter 'B' to print both the Procedure and CPT Code in a"
  1. S DIR("?",2)="barcode format. 'C' to print only the CPT Code barcode,"
  1. S DIR("?")="or 'P' to print only the procedure in a barcode format."
  1. D ^DIR S:$D(DIRUT) RAXIT=1
  1. D KILLDIR G:RAXIT KILL S RAPRNT=Y(0)
  1. I $E(RAPRNT,1)="B" D BOTH G:RAXIT KILL ; sort by CPT or Procedure?
  1. S RAXIT=$$ITYPE() G:RAXIT KILL
  1. S RAXIT=$$PROC^RABAR1() G:RAXIT KILL
  1. I '$D(^TMP($J,"RA PROC")) D KILL Q
  1. DEV ; Device selection
  1. W ! S %ZIS="QM",%ZIS("A")="Select a printer with barcode setup: "
  1. S %ZIS("B")=$S($D(^TMP($J,"RA BARDEV"))\10:$O(^("RA BARDEV","")),1:"")
  1. S %ZIS("S")="I $$DSCR^RABAR(+Y)" D ^%ZIS
  1. I POP D KILL Q
  1. I $D(RATEST) S ^TMP($J,"RA BARDEV",ION)=""
  1. I $D(IO("Q")) D G KILL
  1. . S ZTRTN="START^RABAR"
  1. . S ZTDESC="Rad Nuc/Med Print procedure/CPT code in a barcode format."
  1. . D ZTSAVE^RABAR1,^%ZTLOAD
  1. . I +$G(ZTSK("D"))>0 W !?5,"Request Queued, Task #: ",$G(ZTSK)
  1. . D HOME^%ZIS
  1. . K %X,%XX,%Y,%YY,IO("Q"),X,Y
  1. . Q
  1. START ; Start processing data & printing to the device here
  1. S:$D(ZTQUEUED) ZTREQ="@" U IO
  1. I '$D(RATEST) D
  1. . S RAHD1="Barcode print of Imaging "
  1. . S:$E(RAPRNT,1)="B" RAHD1=RAHD1_"Procedures & CPT Codes"
  1. . S:$E(RAPRNT,1)="C" RAHD1=RAHD1_"CPT Codes"
  1. . S:$E(RAPRNT,1)="P" RAHD1=RAHD1_"Procedures"
  1. . Q
  1. S:$D(RATEST) RAHD1="Barcode test print"
  1. S RAHD2="Printed on: "_RADT,RAPG=0
  1. S $P(RALINE,"-",(IOM+1))="",RA1=""
  1. I $D(RATEST) D
  1. . D HDR Q:RAXIT D PRINT1^RABAR1
  1. . Q
  1. E D
  1. . N RAEOS S RAEOS=$S($D(RAVHI):RAVHI,1:6) D HDR Q:RAXIT
  1. . F S RA1=$O(^TMP($J,"RA PROC",RA1)) Q:RA1="" D Q:RAXIT
  1. .. S RA2=0 F S RA2=$O(^TMP($J,"RA PROC",RA1,RA2)) Q:RA2'>0 D Q:RAXIT
  1. ... D PRINT^RABAR1
  1. ... Q
  1. .. Q
  1. . Q
  1. W ! D ^%ZISC
  1. D KILL
  1. Q
  1. BOTH ; Ask the user which to sort by i.e, CPT Code -or- Procedure
  1. W ! D KILLDIR S DIR(0)="SOA^C:CPT Code;P:Procedure"
  1. S DIR("A")="Select the data element you wish to sort by: "
  1. S DIR("?",1)="Enter 'C' to sort by the CPT Code, or 'P' to sort by the"
  1. S DIR("?")="procedure."
  1. D ^DIR S:$D(DIRUT) RAXIT=1
  1. D KILLDIR Q:RAXIT S RASORT=Y(0)
  1. Q
  1. DOLLARY ; Caculate the new value of $Y for formatting purposes.
  1. S RADX=$X,RADY=($Y+RAVHI) D ZOSF^RABAR1(RADX,RADY)
  1. Q
  1. DSCR(Y) ; Device screen logic, select only barcode capable devices.
  1. N RABAR0,RABAR1,RATERMTY S RATERMTY=+$G(^%ZIS(1,+Y,"SUBTYPE"))
  1. Q:'RATERMTY 0 ; missing pointer to Terminal Type file!
  1. S RABAR0=$G(^%ZIS(2,RATERMTY,"BAR0")) ; barcode off node
  1. S RABAR1=$G(^%ZIS(2,RATERMTY,"BAR1")) ; barcode on node
  1. Q:(RABAR0]"")&(RABAR1]"") 1 ; barcoding capability
  1. Q 0
  1. HDR ; Header
  1. W:$Y @IOF S RAPG=RAPG+1
  1. W !?(IOM-$L(RAHD1)\2),RAHD1
  1. W !?(IOM-$L(RAHD2)\2),RAHD2
  1. W ?$S(IOM=132:116,1:64),"Page: ",RAPG
  1. W !,RALINE
  1. ; Check if user stops the task.
  1. I $D(ZTQUEUED) D STOPCHK^RAUTL9 S:$G(ZTSTOP)=1 RAXIT=1
  1. Q
  1. HELP ; Help message for barcode height prompt
  1. W !,"If you don't know how to answer this prompt, first determine which printer",!,"you are going to use. Then exit this option and re-select it from your menu."
  1. W !,"When you are asked if you want to print a sample barcode, enter 'Yes'."
  1. W !,"Enter your printer selection at the 'DEVICE' prompt, then retrieve your",!,"sample printout. If no barcode has printed, contact your IRM and ask them"
  1. W !,"to set up the printer for barcode printing. If a barcode has printed, use",!,"the line counts printed above and below the barcode to determine how many"
  1. W !,"vertical lines the barcode occupies (include the procedure name line printed",!,"below the barcode)."
  1. Q
  1. HI() ; user input of height (in lines) of the barcode
  1. ; returns the height (in lines) of the barcode, OR -1 if user chooses
  1. ; to exit without inputting a number.
  1. N RALOW,RAHI S RALOW=1,RAHI=10
  1. W ! D KILLDIR S DIR(0)="NA^"_RALOW_":"_RAHI
  1. S DIR("A")="Enter the height of the barcode: "
  1. S DIR("?",1)="Enter the height of the barcode in terms of vertical text lines ("_RALOW_" to "_RAHI_")"
  1. S DIR("?")="for your printer, or '^' to exit."
  1. S DIR("??")="^D HELP^RABAR"
  1. D ^DIR S Y=$S($D(DIRUT):-1,1:+Y) D KILLDIR
  1. Q Y
  1. INA(Y) ; Determines if the procedure is inactive
  1. ; Input : IEN of file 71
  1. ; Output: 1 if active, 0 if inactive
  1. Q:+$G(^RAMIS(71,+Y,"I"))=0 1
  1. Q $S(+$G(^RAMIS(71,+Y,"I"))>DT:1,1:0)
  1. ;
  1. ITYPE() ; Select the Imaging Type(s)
  1. N RADIC,RAINPUT,RAQUIT,RAUTIL
  1. S RADIC="^RA(79.2,",RADIC(0)="QEAMZ",RADIC("A")="Select Imaging Type: "
  1. S RAUTIL="RA I-TYPE",RAINPUT=1 D EN1^RASELCT(.RADIC,RAUTIL,"",RAINPUT)
  1. Q RAQUIT
  1. KILL ; Kill all other variables [ includes ^TMP($J) ]
  1. K:'$D(RATEST) ^TMP($J,"RA BARDEV")
  1. K ^TMP($J,"RA I-TYPE"),^TMP($J,"RA PROC")
  1. K %X,%XX,%Y,%YY,RA1,RA2,RAHD1,RAHD2,RALINE,RAPG,RAPG1,RATEST,X,Y
  1. K ZTDESC,ZTRTN,ZTSAVE
  1. K DDH,I,POP
  1. Q
  1. KILLDIR ; Kill off variables from DIR call
  1. K DIR,DIROUT,DIRUT,DTOUT,DUOUT
  1. Q
  1. LINE ; Print ten lines of text
  1. N I F I=1:1:10 W !,"LINE ",I
  1. Q