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

INHRTH1.m

Go to the documentation of this file.
  1. INHRTH1 ;DP; 2 Apr 98 16:16;27 Dec 95 10:39;Throughput analyzer report II
  1. ;;3.01;BHL IHS Interfaces with GIS;;JUL 01, 2001
  1. ;COPYRIGHT 1991-2000 SAIC
  1. Q
  1. PARM() ;Get parameters
  1. ;
  1. S DIC=4005,DIC(0)="AEMNQZ"
  1. S POP=0 D DES Q:'Y Q:POP 0
  1. S (INBEG,INEND)=0
  1. Q:'$$GETRNG(.INBEG,.INEND) 0
  1. S POP=0 D STU Q:POP 0
  1. I ST="" S ST=X1 W "ALL"
  1. D DET Q:POP 0
  1. Q 1
  1. ;
  1. DES ;Get multiple destinations
  1. K X,X2,IN1 S X2=""
  1. F I=1:1 D Q:POP W:Y=-1&(X2="") "ALL" Q:Y=-1
  1. .D ^DIC S:X[U POP=1 Q:POP Q:+Y<1
  1. .S X(+Y)=$P(^INRHD(+Y,0),U)
  1. .S IN1(X(+Y))="",X2=X2_(+Y)_","
  1. Q
  1. GETRNG(START,STOP) ;get start & stop dates
  1. ;
  1. S START=1,STOP=999999999
  1. W ! Q:'$$IEN(.START,"Starting Date: ") 0
  1. ; Search starts on the previous day at midnight.
  1. ; The asking start date
  1. S INABEG=Y
  1. W ! Q:'$$IEN(.STOP," Ending Date: ") 0
  1. ; The asking stop date
  1. S INAEND=Y
  1. ; Set up the date/time
  1. D GETDATE(.INABEG,.INAEND,.START,.STOP)
  1. Q 1
  1. ;
  1. IEN(IEN,ASK) ;read date
  1. ;
  1. S %DT="TAEX",%DT("A")=$G(ASK) D ^%DT Q:Y<1 0
  1. Q 1
  1. ;
  1. Q
  1. DET ;Detail yes/no
  1. W ! S DET=$$YN^UTSRD("Detailed: ;N")
  1. I DET[U S POP=1 Q
  1. INT ;Read time interval
  1. W !! D ^UTSRD("Time interval: ;1.4AN;;;60 ;;;;;INTM","Enter 1 to 60 Minutes Or 1H to 24H for Hours. ") I 'INTM S POP=1 Q
  1. D PAGES
  1. W @IOF,!,"Destination: " I $L(X2)=0 W "All "
  1. E F I=1:1:$L(X2,",")-1 W ?13,$P(^INRHD($P(X2,",",I),0),U),!
  1. ;W !,"Status(s): " F I=1:1:$L(ST) W ?13,$P($P(X3,";",I),":",2),!
  1. W !,"Status(s): " F I=1:1:$L(ST) W ?13,$P($P(X3,$E(ST,I)_":",2),";"),!
  1. W !,"From: ",$$CDATASC^%ZTFDT($E(INABEG,1,12),3,1)
  1. W !," To: ",$$CDATASC^%ZTFDT($E(INAEND,1,12),3,1),!
  1. W !,"Detail: ",$S(DET=1:"Yes",1:"No"),!
  1. W !,"Time intervals: ",INTM W $S(INTM["H":"r",1:"Minutes") W !!
  1. W "This report is about ",PAGES," page" W:PAGES>1 "s" W " long",!!
  1. S Z=$$CR^UTSRD
  1. I Z S POP=1 Q
  1. ; taskman variables
  1. ; ST = status string
  1. ; X = detail 1 yes 0 no
  1. ; X2 = destination list (IEN,...)
  1. ; INBEG = beginning date@time
  1. ; INEND = ending date@time
  1. ; INTM = time interval
  1. ;
  1. S INLOAD=ST_U_DET_U_X2_U_INBEG_U_INEND_U_INTM_U_INABEG_U_INAEND
  1. W ! Q
  1. ;
  1. STU ;Build status string
  1. N I,C S (X1,ST)=""
  1. S X3=$P(^DD(4001,.03,0),U,3,99)
  1. F I=1:1:$L(X3,":")-1 S X1=X1_$P($P(X3,";",I),":")
  1. W ! F I=1:1 D ST Q:C=""!POP
  1. Q
  1. ST ;Display status list
  1. W ! D ^UTSRD("Status: ","^D ST0^INHRTH1") Q:POP
  1. S C=X Q:C=""
  1. I C=U S POP=1 Q
  1. I C="ALL" S ST=X1,C="" Q
  1. ; enter a "-" to remove an item
  1. I C["-",$L(ST)>0 S C=$E(C,2) D Q
  1. .S ST=$E(ST,1,($F(ST,C)-2))_$E(ST,($F(ST,C)),99)
  1. I X1[(C) W " ",$P($P(X3,";",($F(X1,C)-1)),":",2) S ST=ST_C Q
  1. ST0 N I W !,"Please select from:"
  1. F I=1:1:$L(X1) W !," ",$P($P(X3,";",I),":")," ",$P($P(X3,";",I),":",2)
  1. W !," ALL"
  1. S:$$CR^UTSRD POP=1
  1. Q
  1. ST1 ;get the status string to be printed as part of the header.
  1. ; INLN(3) = line 1
  1. ; INLN(4) = line 2
  1. N I
  1. S X=$P(^DD(4001,.03,0),U,3,99),(X3,X4)=""
  1. ;F I=1:1:$L(ST) S X3=X3_$P($P(X,";",I),":",2) S:I<$L(ST) X3=X3_", "
  1. F I=1:1:$L(ST) S X3=X3_$P($P(X,$E(ST,I)_":",2),";") S:I<$L(ST) X3=X3_", "
  1. I $L(X3)>(IOM-8) S X4=X3 D
  1. .F I=$L(X4,","):-1 S X3=$P(X4,",",1,I) I $L(X3)<((IOM+8)\2) S X4=$P(X4,",",(I+1),99) Q
  1. S INLN(3)=X3,INLN(4)=X4
  1. Q
  1. PAGES ;Calculate number of pages for the report
  1. ; time periods * destenations * number of statuses * number of days \ 55
  1. S X=INTM S:INTM["H" X=INTM*60
  1. S X=1440\X*($S(DET:$L(ST),1:1))
  1. S X=X*($S(X2[",":$L(X2,",")-1,1:$P(^INRHD(0),U,4)))
  1. S X=X*($$CDATF2H^%ZTFDT(INEND)-$$CDATF2H^%ZTFDT(INBEG))
  1. S PAGES=X\55 S:PAGES<1 PAGES=1
  1. Q
  1. ;
  1. GETDATE(INASTART,INAEND,INSTART,INEND) ; setup the date/time
  1. ; Description: Set the start and end times appropriately
  1. ; Return: None
  1. ; Parameters:
  1. ; INASTART = The asking start date from user
  1. ; INAEND = The asking end date from user
  1. ; ( must be passed in by reference because they will
  1. ; be adjusted, i.e. INAEND=T will become INAEND=T@2400 )
  1. ; INSTART = The reference start date to be searched in ^INTHU
  1. ; INEND = The reference end date to be searched in ^INTHU
  1. ;
  1. ; Code Begins:
  1. N INTEMP
  1. S INEND=$G(INAEND),INSTART=$G(INASTART)
  1. S:'INEND!(INEND=DT) INEND=DT_".24"
  1. ; Take care a special case (start date T-1@0800 and end date t-1)
  1. S:(INEND\1=INEND)&(INSTART\1=INEND) INEND=INEND+.24
  1. I (INEND-INSTART)<0 D
  1. . ; a RECENT to PAST search criteria
  1. . S INTEMP=INSTART,(INASTART,INSTART)=INEND
  1. . S:((INSTART\1)=INSTART) INSTART=INSTART-.0000001
  1. . I (INTEMP\1)=INTEMP S INEND=INTEMP+.999999,INAEND=INTEMP+.24
  1. . I (INTEMP\1)'=INTEMP S (INAEND,INEND)=INTEMP
  1. E D
  1. . ; a PAST to RECENT search criteria
  1. . I ((INEND\1)=INEND) S INAEND=INEND+.24,INEND=INEND+.999999
  1. . E S INAEND=INEND,INEND=INEND+.000099 ; Because second resolution can not be entered
  1. . S INASTART=INSTART,INSTART=INSTART-.0000001
  1. ; At this point, INSTART AND INEND are defined, however we need
  1. ; to look it up in ^INTHU for the existing date value
  1. S INSTART=INSTART-3
  1. S INSTART=$O(^INTHU("B",INSTART))
  1. S INEND=$O(^INTHU("B",INEND),-1)
  1. ; if start date is not found, set it to end date. This only
  1. ; happened if start date is greater than the latest date in ^INTHU
  1. I '$G(INSTART) S INSTART=INEND
  1. ; if end date is not found, set it to start date. This only happened
  1. ; when end date is smaller than the earliest date in ^INTHU
  1. I '$G(INEND) S INEND=INSTART
  1. Q