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

IBERSP.m

Go to the documentation of this file.
  1. IBERSP ;ALB/ARH - CREATE/PRINT CHECK-OFF SHEET CPT LIST ; 11/5/91
  1. ;;Version 2.0 ; INTEGRATED BILLING ;; 21-MAR-94
  1. ;;Per VHA Directive 10-93-142, this routine should not be modified.
  1. ;
  1. ;request ambulatory surgery check-off sheet by group ie. not for an appointment
  1. ;***
  1. ;S XRTL=$ZU(0),XRTN="IBERSP-1" D T0^%ZOSV ;start rt clock
  1. D HOME^%ZIS W @IOF,!!,?20,"Print Clinic Check-Off Sheet",!!!
  1. SLT S DIC="^IBE(350.7,",DIC(0)="AEQ" D ^DIC K DIC I Y>0 S IBG(+Y)="" G SLT
  1. G:'$D(IBG) END
  1. W !!,"This report requires a 132 column printer." S %ZIS="QM" D ^%ZIS G:POP END
  1. I $D(IO("Q")) S ZTRTN="RQT^IBERSP",ZTSAVE("IBG(")="",ZTDESC="A.S. Check-Off Sheets" D ^%ZTLOAD K IO("Q") D HOME^%ZIS G END
  1. U IO
  1. ;***
  1. ;I $D(XRT0) S:'$D(XRTN) XRTN="IBERSP" D T1^%ZOSV ;stop rt clock
  1. D RQT
  1. END ;
  1. ;***
  1. ;I $D(XRT0) S:'$D(XRTN) XRTN="IBERSP" D T1^%ZOSV ;stop rt clock
  1. I $D(ZTQUEUED) S ZTREQ="@" Q
  1. K DTOUT,DUOUT,IBG,X,Y D ^%ZISC
  1. Q
  1. ;(possible) external entry pt.
  1. ;print requested check-off sheets for groups in IBG (without patient data, with box)
  1. RQT ;
  1. ;***
  1. ;S XRTL=$ZU(0),XRTN="IBERSP-2" D T0^%ZOSV ;start rt clock
  1. S IBGRP="" F S IBGRP=$O(IBG(IBGRP)) Q:IBGRP="" D CPT(IBGRP,"",0,DT,1) W @IOF Q:$$STOP^IBERS1
  1. K IBG,IBGRP,^TMP("IBRSC",$J)
  1. ;***
  1. ;I $D(XRT0) S:'$D(XRTN) XRTN="IBERSP" D T1^%ZOSV ;stop rt clock
  1. G END
  1. ;
  1. ;external entry point
  1. CPT(GRP,DIV,TOF,ADT,BOX) ;prints the CPT list for particular group
  1. ;print device must be defined, opened and the paper set on the line that printing is to begin on
  1. ;does not close the device when done or set printer to TOF
  1. ;Inputs: GRP = the IFN (350.7) of the group to be printed
  1. ; DIV = division of clinic, needed for charge calculation
  1. ; DT = date of appointment, needed for charge calculation (DT if "")
  1. ; TOF = top of form, the line number at which to begin printing
  1. ; BOX = true if a card box should be printed in upper left corner
  1. ;first creates a temp file in sequential format, then prints that file in column format
  1. ;whoever calls this must delete ^TMP("IBRSC") themselves after they have printed all lists,
  1. ;it is not killed here to speed up CPT lists by already having them partially formated for reuse
  1. D:'$D(^TMP("IBRSC",$J,GRP)) CREATE^IBERSP1 Q:'$D(^TMP("IBRSC",$J,GRP))
  1. I BOX D:'$D(^TMP("IBRSC",$J,"B")) BOX^IBERSP1 D PRNTBX
  1. D PRINT
  1. Q
  1. ;
  1. PRINT ;reformats list into multiple columns for specific TOF then prints it out
  1. N CAT,COL,PG,GCOL,HDR,LN,CW,MAXLN,MINLN,LINE,CONT,CHDR,SL,I,J,X,Y,N
  1. Q:'$D(^TMP("IBRSC",$J,+GRP))
  1. S SL=IOSL,CAT=0,(MAXLN,LN,MINLN,COL)=1,PG=$S(BOX:1,1:0),GCOL=^TMP("IBRSC",$J,GRP),HDR=^TMP("IBRSC",$J,GRP,0)
  1. S HDR="CPT Codes for "_HDR,HDR=$J(HDR,IOM/2+($L(HDR)\2)) D:'BOX HDR
  1. F I=1:1 S CAT=$O(^TMP("IBRSC",$J,GRP,CAT)) Q:CAT="" D
  1. . S CONT=0 F Q:SL'<(LN+TOF+3) D NEWCOL
  1. . S CHDR=^TMP("IBRSC",$J,GRP,CAT,0),CW=$L(CHDR),N=0 F X="",CHDR D PL
  1. . F J=1:1 S N=$O(^TMP("IBRSC",$J,GRP,CAT,N)) Q:N="" D
  1. .. S LINE=^(N) F Q:SL>(LN+TOF) S CONT=1 D NEWCOL
  1. .. S X=LINE D PL
  1. D P1 K ^TMP("IBRSC",$J,"F")
  1. Q
  1. ;
  1. PL ;sets each formated line into temp file, X is added to the end of the current line,
  1. ;then the line is padded with spaces to the end of the column (plus # IC spaces)
  1. S Y=$G(^TMP("IBRSC",$J,"F",PG,LN)),Y=Y_$J("",((CW*(COL-1))-$L(Y)))
  1. S ^TMP("IBRSC",$J,"F",PG,LN)=Y_X,LN=LN+1 S:LN>MAXLN MAXLN=LN
  1. Q
  1. ;
  1. NEWCOL ;go to next column, or next page
  1. S COL=COL+1 D:COL>GCOL HDR S LN=MINLN I CONT F X="",CHDR D PL
  1. Q
  1. ;
  1. HDR ;set GROUP header into the temp file
  1. S LN=1,PG=PG+1 I COL>GCOL S TOF=0
  1. S Y=HDR,^TMP("IBRSC",$J,"F",PG,LN)=Y,LN=LN+1,COL=1,MINLN=LN
  1. Q
  1. ;
  1. P1 ;print each line of finally formated temp file
  1. S X="" F I=1:1 S X=$O(^TMP("IBRSC",$J,"F",X)) Q:X'?1N.N W:X>1 @IOF S Y="" F J=1:1 S Y=$O(^TMP("IBRSC",$J,"F",X,Y)) Q:Y="" W !,^TMP("IBRSC",$J,"F",X,Y)
  1. Q
  1. ;
  1. PRNTBX ;print a box in upper left corner and title
  1. N HDR,CTR,IBLG,I5,I6,X,I
  1. S HDR=^TMP("IBRSC",$J,GRP,0),CTR=$G(^TMP("IBRSC",$J,"B")),IBLG=$S(($L(HDR)+30)>CTR:1,1:0),CTR=CTR\2
  1. S I6=$S(IBLG:$J(HDR,CTR+($L(HDR)\2)),1:"")
  1. S I5=$S(IBLG:$J("CPT Codes for ",(CTR+7)),1:$J("CPT Codes for "_HDR,CTR+7+($L(HDR)\2)))
  1. S X="" F I=1:1 S X=$O(^TMP("IBRSC",$J,"B",X)) Q:X="" W !,^TMP("IBRSC",$J,"B",X)_$S($D(@("I"_I)):@("I"_I),1:"")
  1. S TOF=(TOF+I+1)
  1. Q