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

AZXZSUP3.m

Go to the documentation of this file.
AZXZSUP3 ;SUPPORT DATABASE PROGRAM[ 05/01/95   1:25 PM ]
 ;04/22/92  JOHN H. LYNCH
 ;
 ;THIS ROUTINE WILL ALLOW A USER TO SEARCH
 ;FOR ANY WORKING LOGS UNDER THEIR INITIALS
 ;AND FOR ANY PARTICULAR SET OF DATES.
 
MAIN ;AZXZSUP3 PROGRAM CONTROL
 ;INITIALIZE LOCAL VARIABLES
 S DA=0                   ;INITIALIZE INTERNAL ENTRY NUMBER
 S FILE="1991012"         ;FILE = FILE NUMBER (SUPPDB)
 S DIC="^DIZ(FILE,"       ;DIC = FILE NAME (SUPPDB)
 S DR=".01:7"             ;WRITE ALL FIELDS TO TEMP. GLOBAL (TMPGBL)
 
 D WORKPRNT
 I (INIT'="^") R !!,"Do you want to print another Working Log? Y// ",YN
 I YN="" S YN="Y"
 I YN="Y" G MAIN
 K DA,DIC,DR,YN,INIT,LDATE,X,UDATE,L
 K FR,FLDS,BY,DIS(0),DIS(1),DIC(0),%DT
 Q
 
WORKPRNT ;PRINTOUT WORKING LOG
 
 ;CLEAR SCREEN
 W @IOF
 
 W !!!,"Working Log Print..."
 W !!!! H 1
 
SELECT ;ALLOWS USER TO INPUT WHAT TO INCLUDE
 ;IN WORKING LOG PRINTOUT
 
 R !,"Select Initials: ",INIT
 
 ;IF "^" OR "" QUIT AND RETURN TO MAINMENU
 I (INIT="^")!(INIT="") S YN="N" Q
 
 ;IF "?" GIVE HELP AND RETURN TO SELECT SUB-ROUTINE
 I INIT="?" W !!,"Please enter the initials you want to print out on Working Log Print",! G SELECT
 
 ;CHECK FOR VALID INITIALS
 I INIT'?2.3U W !!,"Initials must be 2-3 Upper Case Alpha Characters.",!,*7 G SELECT
 D INITLKUP ;CHECK TO SEE IF INITIALS MATCH WHAT IS IN INITIALS FILE
 I INIT<1 W !!,"Initials are not on file in the INITIALS file.",!,*7 G SELECT
 ;IF THEY ARE ON FILE CONTINUE, OTHERWISE FLAG THEM AND G SELECT
 
LBDATE R !,"Select Lower Boundary Date :",LDATE
 
 ;IF "^" RETURN TO PREVIOUS PROMPT (SELECT)
 I LDATE="^" G WORKPRNT 
 
 ;IF "" SET LDATE = LOWEST DATE POSSIBLE & UDATE = CURRENT DATE
 ;GO RIGHT TO PRINTOUT; THEN QUIT
 I LDATE="" D DEFAULT D PRINTOUT Q  
 
 ;IF "?" GIVE HELP AND RETURN TO LDATE PROMPT
 I LDATE="?" W !!,"Give the lower boundary date for Working Log Printout",!,"OR press return to receive ALL working logs [mm/dd/yy].",! G LBDATE
 
 ;CHECK TO SEE IF A VALID DATE HAS BEEN ENTERED
 I LDATE'?2N1"/"2N1"/"2N W !!,"Illegal date; check format and re-enter lower boundary date.",!,*7 G LBDATE
 
 ;CONVERT DATE (CONVERT)
 S X=LDATE     ;X = DATE TO CONVERT USING ^%DT
 D CONVERT
 ;DATE FORMAT WAS ILLEGAL
 I Y<1 W !!,"Illegal date; check format and re-enter upper boundary date.",!,*7 G LBDATE
 S LDATE=Y
 
UBDATE R !,"Select Upper Boundary Date :",UDATE
 
 ;IF "^" RETURN TO PREVIOUS PROMPT (LBDATE)
 I UDATE="^" G LBDATE
 
 ;IF "" WRITE "UPPER BOUNDARY MUST BE ENTERED"
 I UDATE="" W !!,"An upper boundary date must be entered when a lower limit has been given.",!,*7 G UBDATE
 
 ;IF "?" GIVE HELP AND RETURN TO LDATE PROMPT
 I UDATE="?" W !!,"Give the upper boundary date for Working Log Printout [mm/dd/yy].",! G UBDATE
 
 ;CHECK TO SEE IF A VALID DATE HAS BEEN ENTERED
 I UDATE'?2N1"/"2N1"/"2N W !!,"Illegal date; check format and re-enter upper boundary date.",!,*7 G UBDATE
 
 ;CONVERT DATE (CONVERT)
 S X=UDATE       ;X = DATE TO CONVERT USING ^%DT
 D CONVERT
 ;DATE FORMAT WAS ILLEGAL
 I Y<1 W !!,"Illegal date; check format and re-enter upper boundary date.",!,*7 G UBDATE
 S UDATE=Y
 
 ;CHECK TO SEE IF UDATE >= LDATE
 I UDATE'>LDATE!UDATE=LDATE W !!,"Upper boundary date must be greater than or equal to lower boundary date.",!,*7 G UBDATE
 
 ;DO PRINTOUT; THEN QUIT
 D PRINTOUT
 Q
 
PRINTOUT ;PRINTOUT WORKING LOG LIST USING FILEMAN'S DIP ROUTINE
 S L=0,FR=""
 S DIC="^DIZ(FILE,"  ;FILE NUMBER FOR SUPPDB
 S FLDS="[PRNTWORK]"    ;PRINT TEMPLATE
 S BY="[SRCHWORK]"      ;SEARCH (SORT) TEMPLATE
 ;SORT TEMPLATE SETTING DIS(0) TO CHECK FOR WORKING LOGS BETWEEN DATES
 S DIS(0)="S STATUS=0,OCCUR=0,STATUS=$O(^DIZ(FILE,D0,1,""B"",""W"",STATUS)) I STATUS'="""" I $O(^DIZ(FILE,""C"",INIT,D0,STATUS,OCCUR)) I ($J($P(^DIZ(FILE,D0,0),U,4),7,0)'<LDATE)&($J($P(^DIZ(FILE,D0,0),U,4),7,0)'>UDATE)"
 ;SORT TEMPLATE SETTING DIS(1) TO CHECK FOR NON-CLOSED LOGS
 S DIS(1)="S STATUS2=0 I '$O(^DIZ(FILE,D0,1,""B"",""C"",STATUS2))"
 D EN1^DIP              ;CALL DIP ROUTINE
 Q
 
DEFAULT ;SET DEFAULT DATES TO INCLUDE ALL CURRENT LOGS
 S LDATE="2920401"    ;SET TO EARLIER THAN EARLIEST POSSIBLE LOG DATE
 S UDATE=DT           ;SET TO CURRENT DATE
 Q
INITLKUP ;CHECK TO MAKE SURE USER INPUT OF INITIALS ARE ON FILE IN 'INITIALS'
 S DIC="^DIZ(1991016," ;SET DIC="INITIALS FILE"
 S X=INIT              ;SET X = INITIALS GIVEN BY USER
 S DIC(0)="XZ"         ;X = EXACT MATCH, Z = SET Y NODES
 D ^DIC                ;CALL FILEMAN LOOKUP ROUTINE (DIC)
 S INIT=$P(Y,U,1)      ;SET INIT TO INTERNAL NUMBER FOR INITIALS
 Q
 
CONVERT ;CONVERT USER DATES TO FILEMAN DATE FORMAT
 ;SET LOCAL VARIABLES
 S %DT="EXT"  ;E=ECHO ANSWER;X=EXACT DATE;T=TIME ALLOWED, NOT REQUIRED
 D ^%DT        ;VALUE RETURNED IN Y
 Q