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

IBDF1B.m

Go to the documentation of this file.
  1. IBDF1B ;ALB/CJM - ENCOUNTER FORM (printing forms for appointments); 3/1/93
  1. ;;3.0;AUTOMATED INFO COLLECTION SYS;**29**;APR 24, 1997
  1. ;
  1. ;IBSRT=1 for sort by clinic/patient name
  1. ;IBSRT=2 for sort by terminal digits
  1. ;IBSRT=3 for sort by clinic/terminal digits
  1. ;
  1. ;SELECTBY="P" if user wants to select appts by patient
  1. ;SELECTBY="C" if user wants to select appts by division/clinic
  1. ;
  1. ;IBDT=date for appointments
  1. ;IBREPRNT'="" if this is a reprint of a previous job - then it's either equal to clinic name or 1st 4 terminal digits
  1. ;IBSTRTDV is the division to start from in the case of a reprint
  1. ;IBADDONS=1 if user wants to do add-ons only, 0 otherwise
  1. ;
  1. EN ;
  1. N IBREPRNT,SELECTBY,IBDT,IBSRT,IBADDONS,IBSTRTDV,QUIT,X
  1. S (IBSTRTDV,IBREPRNT)="",(QUIT,IBADDONS)=0
  1. ;
  1. ;set the error trap so workspace in ^TMP is erased in case of abnormal termination of the print job
  1. S X="ERRORTRP^IBDF1B",@^%ZOSF("TRAP")
  1. ;
  1. K ^TMP("IBDF",$J),^TMP("IB",$J)
  1. D HOME^%ZIS
  1. D
  1. .D SELECTBY Q:QUIT S:SELECTBY="P" IBSRT=1 ;if selecting by patient then sort by clinic/patient rather than by terminal digits
  1. .D:SELECTBY="C" SORTBY^IBDF1BA Q:QUIT
  1. .D APPTDATE Q:QUIT
  1. .;now allow user to makes selections, whether by patient or clinic
  1. .D @SELECTBY
  1. .;
  1. .;if nothing selected exit
  1. .Q:'$D(^TMP("IBDF",$J))
  1. .;
  1. .;since selecting by entire clinics, may want to do add-ons only or restart the job
  1. .I SELECTBY="C" D Q:QUIT
  1. ..D ADDONS Q:QUIT
  1. ..D REPRINT Q:QUIT
  1. ;
  1. ;
  1. ;if nothing selected exit
  1. END G:('$D(^TMP("IBDF",$J)))!QUIT EXIT
  1. W !,$C(7),"** Encounter Forms require a page size of 80 lines and 132 columns. **"
  1. K %IS,%ZIS,IOP S %ZIS="QM",%ZIS("A")="OUTPUT DEVICE: " D ^%ZIS G:POP EXIT
  1. I $D(IO("Q")) S ZTRTN="^IBDF1B1",ZTDESC="IBDF Encounter Forms",ZTSAVE("^TMP(""IBDF"",$J,")="",ZTSAVE("IB*")="" D ^%ZTLOAD K IO("Q") W !,$S($D(ZTSK):"Request Queued Task="_ZTSK,1:"Request Canceled") D HOME^%ZIS G EXIT
  1. U IO
  1. D ^IBDF1B1
  1. EXIT ;
  1. K ^TMP("IBDF",$J),^TMP("IB",$J),^TMP("RPT",$J),^TMP("DFN",$J)
  1. I $D(ZTQUEUED) S ZTREQ="@" Q
  1. K DTOUT,DUOUT,DIRUT,DIROUT,X,Y,D0,DA,IBTYPE
  1. D ^%ZISC
  1. Q
  1. ;
  1. REPRINT ;for prior job that partially completed?
  1. ;IBSTRTDV is the division to restart from
  1. ;IBREPRNT is the clinic or first 4 of terminal digits to restart from
  1. S DIR(0)="Y",DIR("A")="IS THIS A REPRINT OF A PREVIOUS RUN"
  1. S DIR("B")="NO",DIR("?")="ANSWER YES IF SOME OF THE FORMS WERE ALREADY PRINTED BY A PREVIOUS JOB THAT DID NOT SUCCESSFULLY COMPLETE"
  1. D ^DIR K DIR I $D(DIRUT)!(Y=-1) S QUIT=1 Q
  1. I Y D I IBREPRNT="" S QUIT=1 Q
  1. .I IBSRT=2 D ;sorting by division/terminal digit
  1. ..;ask which division to restart from
  1. ..S IBSTRTDV=$$STARTDIV^IBDF1BA I IBSTRTDV="" S IBREPRNT="" Q
  1. ..;ask which terminal digit to restart from
  1. ..D TERMSTRT^IBDF1BA Q:IBREPRNT=""
  1. .I (IBSRT=1)!(IBSRT=3) D CLNCSTRT^IBDF1BA ;sorting by division/clinic, ask which clinic to restart from
  1. Q
  1. ADDONS ;add-ons only?
  1. S DIR(0)="Y",DIR("A")="WANT TO PRINT ADD-ONS ONLY"
  1. S DIR("B")="NO",DIR("?")="ANSWER YES TO ONLY PRINT ADD-ONS"
  1. D ^DIR K DIR I $D(DIRUT)!(Y=-1) S QUIT=1 Q
  1. S IBADDONS=Y
  1. Q
  1. SELECTBY ;select by patient or clinic?
  1. W !,"Do you want to print forms for a particular patient or for entire clinics?",!
  1. K DIR S DIR("B")="Clinic",DIR(0)="SO^P:Patient;C:Clinic",DIR("A")="Select Appointment by"
  1. D ^DIR K DIR I $D(DIRUT) S QUIT=1 Q
  1. S SELECTBY=Y
  1. Q
  1. ;
  1. P ;print by patient - get patient then appointment(s) for date
  1. N IBTMP,IBNM,DFN
  1. ;IBNM=patient name, IBTMP=array to store patient's appts
  1. F K DIC S DIC="^DPT(",DIC(0)="AEQM" D ^DIC K DIC Q:Y<0 S DFN=+Y,IBNM=$P(Y,"^",2) D SEARCH^IBDF1BA,DISP^IBDF1BA
  1. Q
  1. ;
  1. C ;print all appointments for a clinic - find division then clinic, print all/some clinics for all/some divisions
  1. ;
  1. N GROUPS,IEN
  1. ;
  1. ;get the PRINT MANAGER CLINIC GROUPS
  1. S GROUPS=""
  1. K DIR
  1. S DIR(0)="PAO^357.99:AEMQ",DIR("A")="Select Print Manager Clinic Group:",DIR("?")="You can choose from previously defined clinic groups."
  1. F D ^DIR Q:((+Y<0)!$D(DIRUT)) S GROUPS(+Y)="",DIR("A")="Select another Print Manager Clinic Group:"
  1. S GROUPS=0 F S GROUPS=$O(GROUPS(GROUPS)) Q:'GROUPS D
  1. .S IEN=0 F S IEN=$O(^IBD(357.99,GROUPS,10,IEN)) Q:'IEN S IBCLN=+$G(^IBD(357.99,GROUPS,10,IEN,0)) S:IBCLN ^TMP("IBDF",$J,"C",IBCLN)=""
  1. .S IEN=0 F S IEN=$O(^IBD(357.99,GROUPS,11,IEN)) Q:'IEN S IBDIV=+$G(^IBD(357.99,GROUPS,11,IEN,0)) S:IBDIV ^TMP("IBDF",$J,"D",IBDIV)=""
  1. K DIR
  1. G:$O(GROUPS(0)) ENDC
  1. ;
  1. ;now ask divisions and clinics
  1. W !!,"Now you can select individual divisions and clinics."
  1. ;D ASK2^IBODIV G:$D(VAUTD)<11&(VAUTD=0) ENDC
  1. S VAUTD=1 I $P($G(^DG(43,1,"GL")),"^",2) D DIVISION^VAUTOMA I Y=-1 G ENDC
  1. S DIC("S")="I $P(^SC(+Y,0),U,3)=""C"",$S(VAUTD:1,$D(VAUTD(+$P(^(0),U,15))):1,'+$P(^(0),U,15)&$D(VAUTD($O(^DG(40.8,0)))):1,1:0)"
  1. W !!,"If you want to print forms for all clinics in the divisions you have",!,"chosen (for those clinics with forms defined) then select ALL."
  1. W !!,"Otherwise, select the particular clinics you want.",!
  1. S DIC="^SC(",VAUTVB="VAUTC",VAUTNI=2,VAUTSTR="clinic" D FIRST^VAUTOMA K DIC G:$D(VAUTC)<11&(VAUTC=0) ENDC
  1. I VAUTC,VAUTD S ^TMP("IBDF",$J,"D","ALL")=""
  1. I VAUTC,'VAUTD S IBDIV="" F S IBDIV=$O(VAUTD(IBDIV)) Q:IBDIV="" S ^TMP("IBDF",$J,"D",IBDIV)=""
  1. I 'VAUTC S IBCLN="" F S IBCLN=$O(VAUTC(IBCLN)) Q:IBCLN="" S ^TMP("IBDF",$J,"C",IBCLN)=""
  1. ENDC K VAUTNI,VAUTD,VAUTC,VAUTVB,VAUTSTR,IBDIV,IBCLN,DIC
  1. Q
  1. ;
  1. APPTDATE ;print forms for appointments on what date?
  1. K DIR S DIR(0)="D^::AEX",DIR("B")="TODAY",DIR("A")="Appointment Date to Print Forms For"
  1. S DIR("?",1)="Only Clinics and Patients with Appointments on this Date will be allowed."
  1. S DIR("?")="Nothing will print for Appointments in Clinics/Divisions with no forms defined."
  1. D ^DIR K DIR I $D(DIRUT) S QUIT=1 Q
  1. S IBDT=Y
  1. Q
  1. ;
  1. ERRORTRP ;the error trap
  1. K ^TMP("IBDF",$J),^TMP("IB",$J)
  1. D @^%ZOSF("ERRTN")
  1. Q