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

DGENRPD1.m

Go to the documentation of this file.
  1. DGENRPD1 ;ALB/CJM - Veterans with no Application and with a Future Appointment Report; 04/28/2004
  1. ;;5.3;Registration;**147,568**;Aug 13,1993
  1. ;
  1. REPORT ;
  1. N DGENRP
  1. ;
  1. ;Control variables used in generating report
  1. ;DGENRP("BEGIN")=<begining of the date range for appt selection>
  1. ;DGENRP("END")=<ending date of range>
  1. ;DGENRP("ALL")=1 means to include all clinics for appt selection
  1. ;DGENRP("DIVISION",<list of medical center Divisions to include>)=""
  1. ;DGENRP("CLINIC",<list of clinics to include>)=""
  1. ;DGENRP("JUSTONCE")=<1 means that if the patient has multiple appts to print only the first, 0 means print all the patient's appts>
  1. ;
  1. G:'$$ASKRANGE(.DGENRP) EXIT
  1. G:'$$LOCATION(.DGENRP) EXIT
  1. G:'$$JUSTONCE(.DGENRP) EXIT
  1. ;
  1. I $$DEVICE() D PRINT^DGENRPD2
  1. EXIT ;
  1. Q
  1. ;
  1. DEVICE() ;
  1. ;Description: allows the user to select a device.
  1. ;Input: none
  1. ;
  1. ;Output:
  1. ; Function Value - Returns 0 if the user decides not to print or to
  1. ; queue the report, 1 otherwise.
  1. ;
  1. N OK
  1. S OK=1
  1. S %ZIS="MQ"
  1. W !,"*** This report requires a 132 column printer. ******"
  1. D ^%ZIS
  1. S:POP OK=0
  1. D:OK&$D(IO("Q"))
  1. .S ZTRTN="PRINT^DGENRPD2",ZTDESC="Future Appointments with No EnrollmentApplication REPORT",ZTSAVE("DGENRP(")=""
  1. .D ^%ZTLOAD
  1. .W !,$S($D(ZTSK):"REQUEST QUEUED TASK="_ZTSK,1:"REQUEST CANCELLED")
  1. .D HOME^%ZIS
  1. .S OK=0
  1. Q OK
  1. ;
  1. LOCATION(DGENRP) ;
  1. ;Description: asks the user to select locations of future appointments
  1. ;
  1. ;Input: none
  1. ;Output:
  1. ; DGENRP - (pass by reference) used to return selected locations
  1. ; Function Value: 0 on failure, 1 on success
  1. ;
  1. N DIR,SUCCESS
  1. S SUCCESS=1
  1. S DIR("B")="ALL"
  1. S DIR(0)=$S($P($G(^DG(43,1,"GL")),"^",2):"S^A:All;D:by Division;C:by Clinic",1:"S^A:All;C:by Clinic")
  1. S DIR("A")="How do you want to select the clinics to appear in the report? "
  1. S DIR("?")="You have the choice of selecting all clinics, entire divisions, or individual clinics."
  1. D ^DIR
  1. I $D(DIRUT) D
  1. .S SUCCESS=0
  1. E D
  1. .I Y="A" D
  1. ..S DGENRP("ALL")=1
  1. .E D
  1. ..S DGENRP("ALL")=0
  1. ..I Y="C" D
  1. ...S SUCCESS=$$CLINIC(.DGENRP)
  1. ..E D
  1. ...I Y="D" S SUCCESS=$$DIVISION(.DGENRP)
  1. ;
  1. Q SUCCESS
  1. ;
  1. ASKRANGE(DGENRP) ;
  1. ;Description: Asks the user to enter a date range begining no earlier
  1. ;than the current date
  1. ;
  1. Q:'$$ASKBEGIN(.DGENRP) 0
  1. Q:'$$ASKEND(.DGENRP) 0
  1. Q 1
  1. ;
  1. ASKBEGIN(DGENRP) ;
  1. ;Description: Asks the user to enter a beginning date.
  1. ;
  1. ;Input: none
  1. ;
  1. ;Output:
  1. ; Function value=1 if user selected a date, 0 otherwise
  1. ; DGENRP("BEGIN")=date selected
  1. ;
  1. N DIR,X,Y
  1. S DIR(0)="D^::XO"
  1. S DIR("A")="Enter beginning date for future appointments for."
  1. S DIR("B")=$$FMTE^XLFDT($$FMADD^XLFDT(DT,1),"D")
  1. S DIR("?")="Enter the first day to list appointments."
  1. REPEAT D ^DIR
  1. Q:$D(DIRUT) 0
  1. I Y'>DT W !,"Date must be later than today!" G REPEAT
  1. S DGENRP("BEGIN")=Y
  1. Q 1
  1. ;
  1. ASKEND(DGENRP) ;
  1. ;Description: Asks the user to enter an end date.
  1. ;
  1. ;Input:
  1. ; DGENRP("BEGIN") - the earliest possible date
  1. ;
  1. ;Output:
  1. ; Function value=1 if user selected a date, 0 otherwise
  1. ; DGENRP("END")=date selected
  1. ;
  1. N DIR,X,Y
  1. S DIR(0)="D^::X"
  1. S DIR("A")="Enter ending date"
  1. S DIR("B")=$$FMTE^XLFDT(DGENRP("BEGIN"),"D")
  1. S DIR("?")="Enter the last day to list appointments for."
  1. AGAIN D ^DIR
  1. Q:$D(DIRUT) 0
  1. I (Y<$G(DGENRP("BEGIN"))) W !,"Date must be no earlier than "_DIR("B") G AGAIN
  1. S DGENRP("END")=Y
  1. Q 1
  1. ;
  1. DIVISION(DGENRP) ;
  1. ;Description: asks divisions to include
  1. ;
  1. N DIR,QUIT,SUCCESS
  1. S SUCCESS=1
  1. S DIR(0)="PO^40.8:AEM"
  1. S DIR("A")="Select the medical center divisions to include in the report"
  1. S DIR("?")="Appointments will not be included in the report for divisions that you do not select."
  1. S QUIT=0
  1. F D Q:QUIT
  1. .D ^DIR
  1. .I $D(DUOUT)!$D(DTOUT) S QUIT=1,SUCCESS=0 Q
  1. .I ((+Y)'>0) S QUIT=1 Q
  1. .S DGENRP("DIVISION",+Y)=""
  1. S:'$O(DGENRP("DIVISION",0)) SUCCESS=0
  1. Q SUCCESS
  1. ;
  1. CLINIC(DGENRP) ;
  1. ;Description: asks clinics to include
  1. ;
  1. N DIR,QUIT,SUCCESS
  1. S SUCCESS=1
  1. S DIR(0)="PO^44:AEM"
  1. S DIR("A")="Select the clinics to include in the report"
  1. S DIR("?")="Appointments will not be included in the report for clinics that you do not select."
  1. S DIR("S")="I $P(^(0),""^"",3)=""C"""
  1. S QUIT=0
  1. F D Q:QUIT
  1. .D ^DIR
  1. .I $D(DUOUT)!$D(DTOUT) S QUIT=1,SUCCESS=0 Q
  1. .I ((+Y)'>0) S QUIT=1 Q
  1. .S DGENRP("CLINIC",+Y)=""
  1. S:'$O(DGENRP("CLINIC",0)) SUCCESS=0
  1. Q SUCCESS
  1. ;
  1. JUSTONCE(DGENRP) ;
  1. ;Description: Asks wether or not to include only the first appointment
  1. ;for a patient that has multiple appointments
  1. ;
  1. ;Output:
  1. ; Function Value: reuturns 1 on success, 0 on failure
  1. ; DGENRP("JUSTONCE")=<1 for only earliest, 0 for all>
  1. ;
  1. N DIR
  1. S DGENRP("JUSTONCE")=0
  1. S DIR(0)="Y"
  1. S DIR("B")="NO"
  1. S DIR("A")="For patients with multiple appointments, should only the first be listed"
  1. D ^DIR
  1. Q:$D(DIRUT) 0
  1. I +Y=1 S DGENRP("JUSTONCE")=1
  1. Q 1