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

INHMSR1.m

Go to the documentation of this file.
  1. INHMSR1 ;KN; 31 Jan 96 09:56; Statistical Report Definition Screen.
  1. ;;3.01;BHL IHS Interfaces with GIS;;JUL 01, 2001
  1. ;COPYRIGHT 1991-2000 SAIC
  1. ;
  1. ; MODULE NAME: Statistical Report Definition Screen (INHMSR1).
  1. ;
  1. ; PURPOSE:
  1. ; The purpose of the Statistic Report Definition Module (INHMSR1)
  1. ; is to display statistic definition screen, and accept user's
  1. ; selected criteria.
  1. ;
  1. ; DESCRIPTION:
  1. ; The processing of this routine will use List Processor (DWL)
  1. ; to display the definition screen for the user to select sort
  1. ; criteria, range for the items selected and the total option.
  1. ; Predefined selectable fields are stored in global
  1. ; ^UTILITY("INHSR"). The routine will call function GATHER
  1. ; to construct INA array. It calls function GVL to validate user's
  1. ; input entry as maximum of five items can be selected and the
  1. ; range should be valid depends on item selected. It calls function
  1. ; INACHK to verify field .01 range. It calls function INHELP to get
  1. ; help for range input. The hot key will allow the user select from
  1. ; the following options:
  1. ; . Run to calculate statistic and display report on the screen
  1. ; or send it to the printer.
  1. ; . Header/Footer to add optional header/footer to the statistic
  1. ; report.
  1. ; . Abort to exit the screen.
  1. ;
  1. Q
  1. ;
  1. EN(INIEN,INNM) ; Entry point for Statistic Report Definition Module
  1. ;
  1. ; Return: none
  1. ; Parameters:
  1. ; INIEN = File ien
  1. ; INNM = Name of file for statistic report
  1. ; Code begins
  1. N INX,INHEAD,IN,INCNT,INA,INQ,INFLD,INRB,SEL,HEADER,INF1,HD,FT,INFLG,ZTSK
  1. S (INCNT,INFLG)=0
  1. ; Check if file selected has pre-defined field in global.
  1. S INFLG=$D(^UTILITY($J,"INHSR",INIEN))#10
  1. ; Search ^DD cross reference for field ien (infld=field name)
  1. S INFLD=0 F S INFLD=$O(^DD(INIEN,INFLD)) Q:'INFLD D
  1. .S INX=$P(^DD(INIEN,INFLD,0),U,1)
  1. .; only display selectable fields predefined in global
  1. .I $$ISTHERE^INHMSR10(INIEN,INFLD,INFLG) D
  1. ..; Initialize incnt=number of selection user made
  1. ..S INCNT=$G(INCNT)+1
  1. ..; IN(col,row), ex:col=2 is field name i.e. INX
  1. ..S IN(1,INCNT)="",IN(2,INCNT)=INX,IN(3,INCNT)="",IN(4,INCNT)="",IN(5,INCNT)="",IN(6,INCNT)=INFLD
  1. ..S:INFLD=.01 INF1=INX
  1. ..; ListMan, make column 1,3,4,5 selectable.
  1. ..S IN(1,INCNT,0)="",IN(3,INCNT,0)="",IN(4,INCNT,0)="",IN(5,INCNT,0)=""
  1. ..; 1.Make col 1 editable, 2. width=1, 3. input validation
  1. ..S IN(1,INCNT,"DQ")="",IN(1,INCNT,"DQ",0)=1,IN(1,INCNT,"DQ",1)="K:X'?1N!(X>5)!(X<1) X"
  1. ..S IN(1,INCNT,"DQ","?")="D POP^DWLR2(4,1) W ""Enter a number from 1 to 5. The number is used to indicate the sort order."" I $$CR^UTSRD"
  1. ..S (IN(3,INCNT,"DQ"),IN(4,INCNT,"DQ"))="",(IN(3,INCNT,"DQ",0),IN(4,INCNT,"DQ",0))=20,(IN(3,INCNT,"DQ","?"),IN(4,INCNT,"DQ","?"))="D INHELP^INHMSR10("_INIEN_","_INFLD_")",(IN(3,INCNT,"DQ",1),IN(4,INCNT,"DQ",1))=$$GVL^INHMSR10(INIEN,INFLD)
  1. ..S IN(5,INCNT,"DQ")="",IN(5,INCNT,"DQ",0)=1,YN="YNyn",IN(5,INCNT,"DQ",1)="K:X'?1A!(YN'[X) X",IN(5,INCNT,"DQ","?")="D POP^DWLR2(4,1) W ""Enter Y or N to indicate whether a count for this field is desired."" I $$CR^UTSRD"
  1. ; Set hot key for selection - Graph not used - DWLHOT(2)="Graph^GRAPH
  1. S DWLHOT(1)="FILE/EXIT^R",DWLHOT(3)="Hd/Ft^HDFT",DWLHOT(4)="Exit^A"
  1. S INHEAD="D HEADER^INHMSR1(INNM)"
  1. D HOTSET^DWL
  1. W @IOF
  1. ;Setup for list processor
  1. S INRB=0,INQ=0,DWLRF="IN",DWLB="0^3^15^2^25^20^20^2",DWL="KCHQ2FZWXXA5",DWL("TITLE")=INHEAD
  1. ; Processing loop
  1. F Q:INQ=1 D
  1. .; Rebuild in array if error
  1. .D:INRB RBIN(.INA)
  1. .S INRB=0
  1. .D ^DWL
  1. .I (DWLR="R") D Q
  1. ..; If press run, then rebuild INA array, SEL=0
  1. ..S SEL=$$GATHER^INHMSR11(.INA,INCNT)
  1. ..I SEL=0 S INQ=0,INRB=1
  1. ..E D R(INIEN,SEL,.INA) S INQ=1
  1. .;I DWLR="GRAPH" D GRAPH S SEL=$$GATHER^INHMSR11(.INA,INCNT),INQ=0,INRB=1
  1. .I DWLR="HDFT" D HDFT S SEL=$$GATHER^INHMSR11(.INA,INCNT),INQ=0,INRB=1 Q
  1. .I DWLR="A" S INQ=1 W @IOF Q
  1. .; Abort and File/Exit key
  1. .I DWLR="^" S INQ=1 W @IOF Q
  1. .I DWLR="^^" S INQ=1 W @IOF Q
  1. .;Ignore if user hit enter key
  1. .I +DWLR>0 W *7 S SEL=$$GATHER^INHMSR11(.INA,INCNT),INQ=0,INRB=1
  1. Q
  1. ;
  1. RBIN(INA) ; Rebuild IN array.
  1. ;
  1. ; Description: The function RBIN is used to rebuild IN display
  1. ; array if error occurs.
  1. ; Return: none
  1. ; Parameter:
  1. ; INA = Name of statistical report criteria array.
  1. ; Code begins:
  1. N INX
  1. ; Loop thru ina array, inx=order, i=row where selection is at
  1. S INX=0 F S INX=$O(INA(INX)) Q:INX="" D
  1. .S I=$G(INA(INX,5))
  1. .; Rebuild column 1 and 5 (order and total)
  1. .S IN(1,I,"DQ")=INX
  1. .S IN(5,I,"DQ")=$G(INA(INX,7))
  1. .; ina(order,6) contains type of the field
  1. .S IN(3,I,"DQ")=$G(INA(INX,3)),IN(4,I,"DQ")=$G(INA(INX,4))
  1. Q
  1. ;
  1. R(INFL,SEL,INA) ; Entry point for Hotkey run
  1. ;
  1. ; Description: The function R is used to pass the INA array
  1. ; to module INHMSR2 for calculate statistic and display.
  1. ; Return: none
  1. ; Parameters:
  1. ; INFL = File ien (internal entry number)
  1. ; SEL = Number of selection that user made.
  1. ; INA = Array of user selected criteria.
  1. ; Code begins:
  1. W @IOF
  1. N P1
  1. S INA("INHD")=$G(INHD),INA("INFT")=$G(INFT)
  1. D STAT^INHMSR2(INFL,.INA,SEL)
  1. Q
  1. ;
  1. HDFT ;Header and footer
  1. ;
  1. ; Description: The function HDFT is used to ask user to
  1. ; enter text used for the report Header or Footer.
  1. ; Return: none
  1. ; Parameter: none
  1. ; Code begins:
  1. W @IOF
  1. ; NOTE: 2 - required input or timed out; 30 = wait 30 seconds
  1. S P1="Please Enter Header: ;;2,10;;;;;2;;INHD;;30;;IN"
  1. W ! D ^UTSRD(P1,"","",1)
  1. S P1="Please Enter Footer: ;;2,20;;;;;2;;INFT;;30;;IN"
  1. W ! D ^UTSRD(P1,"","",1)
  1. Q
  1. ;
  1. ;
  1. ; Description: The function HEADER is used to display DWL
  1. ; header, and hot key selection.
  1. ; Return: None
  1. ; Parameters:
  1. ; INNM = Name of the current selected file.
  1. ; Code begins:
  1. ; Call function to display the header's name
  1. S INTXT="STATISTICAL REPORT DEFINITION" W ?(IOM-$L(INTXT))/2,INTXT,!
  1. ; Call function to display the DWL screen for user select
  1. W ?(IOM-$L(INNM))/2,INNM,!,"Order ","Field Name",?33,"From",?55,"To",?73,"Count"
  1. ; Display Hotkey for information.
  1. W $$SETXY^%ZTF(0,19),DWLMSG
  1. Q