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

INHMSR2.m

Go to the documentation of this file.
  1. INHMSR2 ;KN; 4 Mar 96 14:12; Statistical Report - Display
  1. ;;3.01;BHL IHS Interfaces with GIS;;JUL 01, 2001
  1. ;COPYRIGHT 1991-2000 SAIC
  1. ;
  1. ; Module Name: Statistical Report Display Module (INHMSR2).
  1. ;
  1. ; PURPOSE:
  1. ; The purpose of the Statistic Report Display Module (INHMSR2)
  1. ; is to calculate the statistic, display, and print the
  1. ; statistic report.
  1. ;
  1. ; DESCRIPTION:
  1. ; The processing of this routine will search the global and
  1. ; calculate statistic based on user input criteria.
  1. ; This routine will perform as the follows:
  1. ; - Locate the data for the field selected, i.e. from what node
  1. ; and which piece of that node.
  1. ; - Search the global, count the number of occurance for the
  1. ; selected field, and save the statistic in INCNT array.
  1. ; - Display the statistic results in INCNT array to screen or
  1. ; to printer as selected by the user
  1. ;
  1. ; Input: INA array
  1. ; Output: INCNT array of statistic data.
  1. ;
  1. Q
  1. STAT(INIEN,INA,SEL) ; Entry point for Statistical Report Display Module
  1. ; Return = None
  1. ; Parameters:
  1. ; INIEN = File ien
  1. ; INA = Array for user selected criteria
  1. ; SEL = Number of selection that user made
  1. ; Code begins:
  1. N:'$D(ZTSK) %DT,INSD,INED,ZTSK,FLD,GLNM,INTYPE
  1. ; Get global name, ex:^INTHU
  1. S GLNM=$$GLN^INHMSR20(INIEN),INTYPE=""
  1. ; Get the range to search
  1. D RANGES^INHMSR21(.INA)
  1. ; queu the task, for display or printing
  1. S ZTRTN="STATTSK^INHMSR2" D QUEUE Q:$D(ZTSK) Q:POP D WAIT^DICD
  1. STATTSK ;TaskMan entry point to print message statistic
  1. N:'$D(ZTSK) INCNT,S,C,INT,INJ,INGL,IINCNT,INHD,INE,INS,DUOUT,INPAGE,INND,INPC
  1. ; For maximum of 4 fields selected, excluding date/time, loop.
  1. F INJ=1:1:($G(SEL)-1) D
  1. .; SEL= number of selection user made
  1. .S:SEL>INJ FLD(INJ)=$O(INA(FLD(INJ-1)))
  1. .; Set type for use in HEAD^INHMSR21, only concate if field is selected
  1. .S:$G(FLD(INJ)) INTYPE=INTYPE_$S(INTYPE="":" ",1:"/")_$G(INA(FLD(INJ),2))
  1. .; INGL=location of the data(node and piece), s(inj)=data field
  1. .; Get piece and node where the data are at
  1. .S INGL=$$GNDP^INHMSR20(INIEN,INA(FLD(INJ),1)),INND(INJ)=$P(INGL,";"),INPC(INJ)=$P(INGL,";",2)
  1. .; int(inj)=the field type (number, date,...).
  1. .; set the indirect INA array for the field type
  1. .S:SEL>INJ IINA="INA(FLD(INJ),6)",INT(INJ)=$G(INA(FLD(INJ),6)),INS(INJ)=$$PRVF^INHMSR20($G(INA(FLD(INJ),3)),.IINA),INE(INJ)=$$NXTF^INHMSR20($G(INA(FLD(INJ),4)),.IINA)
  1. ; Depends on the number of the selection, define indirect incnt array
  1. ; Only count date for file 4001 and 4003
  1. I (INIEN=4001)!(INIEN=4003) S IINCNT="INCNT(INKIM,"
  1. E S IINCNT="INCNT("
  1. ;INL is the new level for the display array
  1. N INL,INOD0
  1. ; For date/time field
  1. S INL=1,INDP(INL)=$G(INA(FLD(0),2))
  1. F INJ=1:1:$G(SEL)-1 D
  1. .S:"Yy"[INA(FLD(INJ),7) IINCNT=IINCNT_"S("_INJ_"),",INL=$G(INL)+1,INDP(INL)=$G(INA(FLD(INJ),2))
  1. S IINCNT=$E(IINCNT,1,$L(IINCNT)-1)_")",INSEL=$G(INL)
  1. ; IN1FT=type of field 1, to compare for pointer or date
  1. ; IN1FT is used for Interface Formatter Task where the field .01
  1. ; is pointer to a file
  1. S IN1FT=$G(INA(FLD(0),6))
  1. S INT=INSD F S INT=$O(@(GLNM_"""B"",INT)")) Q:'INT Q:INT>INED D
  1. .; call function CMPEXT to compare external value for the pointer
  1. .; only use for Interface Formatter Task file
  1. .I $$CMPEXT^INHMSR21(INT,IN1FT) Q
  1. .; From the cross reference, get the field ien e.g: INX=field ien
  1. .S INX=0 F S INX=$O(@(GLNM_"""B"",INT,INX)")) Q:'INX D
  1. ..; If node 0 of the field has value, ex: G(^INTHU(0))
  1. ..S INOD0=$G(@(GLNM_"INX,0)"))
  1. ..I INOD0'="" D
  1. ...;process computed field
  1. ...F INJ=1:1:($G(SEL)-1) I $G(FLD(INJ)) D COMPTD
  1. ...; For the date/time
  1. ...S INKIM=$P(INOD0,U),Y=INKIM\1 D DD^%DT S INKIM=Y
  1. ...S OK=1
  1. ...; OK=flag for count, loop and compare if data in the range
  1. ...F INJ=1:1:($G(SEL)-1) I '$$CMP^INHMSR20(S(INJ),INT(INJ),INS(INJ),INE(INJ)) S OK=0 Q
  1. ...S:OK @IINCNT=$G(@IINCNT)+1
  1. ; Header for pointer to file of .01 field
  1. I (IN1FT["P")&(INA(0)=1) D
  1. . I INSD(1)="" S INSD(1)=$O(INP(""))
  1. . I INED(1)="" S INED(1)=$O(INP(""),-1)
  1. W:'$D(ZTSK) @IOF D:$E(IOST,1,2)="C" CLEAR^DW D HEAD^INHMSR21(INIEN,.INA,INTYPE) Q:$G(DUOUT)
  1. ;Display the range
  1. S INXFLG=0
  1. F INJ=1:1:$G(SEL)-1 D
  1. .I INXFLG W !?(INJ*3),$G(INA(FLD(INJ),2))," : ",$G(INA(FLD(INJ),3))," - ",$G(INA(FLD(INJ),4))
  1. .I 'INXFLG W !,"By : ",$G(INA(FLD(INJ),2))," : ",$G(INA(FLD(INJ),3))," - ",$G(INA(FLD(INJ),4)) S INXFLG=1
  1. W:INXFLG !
  1. ; Calculate total
  1. ; Call FILL to full up the count array with total and subtotal
  1. D FILL^INHMSR20(.INCNT,"INCNT")
  1. S LEVEL=0,SEL=$G(SEL)
  1. ; Call FILL1 to display output of the field
  1. D FILL1^INHMSR20(.INCNT,"INCNT")
  1. Q:$G(DUOUT)
  1. D:$G(SEL)'>1 INDASH^INHMSR21 W !!?4,"REPORT TOTAL" D ADJ^INHMSR21($G(INCNT)) W !!,$G(INA("FT"))
  1. ; end of report
  1. W !!,$J("",30)_"*** End of Report ***"
  1. ; clean up variable
  1. D:$D(ZTSK) CLNUP^%ZTLOAD(.ZTSK)
  1. Q
  1. ;
  1. COMPTD ;Check and process computed field
  1. I (INA(FLD(INJ),6)'["C") S S(INJ)=$P($G(@(GLNM_"INX,"_INND(INJ)_")")),U,INPC(INJ))
  1. E S D0=INX X INA(FLD(INJ),8) S S(INJ)=X
  1. I S(INJ)="" S S(INJ)="Null" Q
  1. ; Call function INXMVG to check internal to external
  1. S S(INJ)=$$INXMVG^INHMSR22(INIEN,INA(FLD(INJ),1),S(INJ))
  1. Q
  1. QUEUE ;
  1. ; Description: The function QUEUE is used to select device for
  1. ; the output and queue if necessary.
  1. ; Return: None
  1. ; Parameters:
  1. ; Code begins:
  1. K IOP D ^%ZIS Q:POP S IOP=ION_";"_IOST_";"_IOM_";"_IOSL
  1. Q:IO=IO(0)
  1. S ZTIO=IOP K IOP D ^%ZISC
  1. F I="INSD","INED","FLD(","INA(","INED(","INSD(","GLNM","INIEN","INTYPE","SEL","HEADER","IN1FT","INDP" S ZTSAVE(I)=""
  1. D ^%ZTLOAD W !?5,"Request "_$S($D(ZTSK):"",1:"NOT ")_"QUEUED!" Q
  1. ;