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

PRSNEE0.m

Go to the documentation of this file.
  1. PRSNEE0 ;WOIFO/PLT - Utility of Nurse POC Data A/E/D ; 08/14/2009 7:56 AM
  1. ;;4.0;PAID;**126**;Sep 21, 1995;Build 59
  1. ;;Per VHA Directive 2004-038, this routine should not be modified.
  1. QUIT
  1. ;
  1. ;return value=^1 is 1 if primary or secondary is a 2-day tour ^2=meal time ^3=y if 2-day tour ^4=meal time of secondary ^5=y if 2-day tour of secondary
  1. PSTOUR(PPI,DFN,PRSNDAY) ;ef - primary and secondary tour info
  1. N A,B
  1. S A=$G(^PRST(458,PPI,"E",DFN,"D",PRSNDAY,0))
  1. I A="" QUIT ""
  1. S B=$P($G(^PRST(457.1,+$P(A,U,2),0)),U,3)_U_$P($G(^(0)),U,5)
  1. S:$P(A,U,13)]"" B=B_U_$P($G(^PRST(457.1,+$P(A,U,13),0)),U,3)_U_$P($G(^(0)),U,5)
  1. QUIT $P(B,U,2)="Y"!($P(B,U,4)="Y")_U_B
  1. ;
  1. ;get prsnt array of tour of duty and exceptions from eta
  1. ;build prsnpc array from the prsnt array
  1. ;prsnpc(start militaty time)=^1-start time (military), ^2- stop time (military)
  1. ; ^3-eta type of time, ^4-meal time
  1. ETAPOC ;convert eta tour of duty and exceptions time segments to array prsnpc
  1. N A,B,C
  1. K PRSNT,PRSNPC D BLDTC^PRSNRMM(.PRSNT,DFN,PPI,PRSNDAY,1)
  1. S PRSNPC=$P(PRSNT,U)'=0_"^"_$P(PRSNT,U,2)
  1. S A=0 F S A=$O(PRSNT(A)) QUIT:'A S B=PRSNT(A) I $P(B,U,4) S A=$P(B,U,4),C=$G(PRSNT(A)),C=C+$S(C#100<45:15,1:55),PRSNPC(+B)=+B_U_C_U_$P(B,U,5)_U_$P(B,U,7)
  1. K PRSNT
  1. QUIT
  1. ;
  1. ADDTS ;add poc time segments in file #451.9999 of file# 451
  1. N PRSNA,PRSNB,PRSNC
  1. S PRSNA=""
  1. F S PRSNA=$O(PRSNPC(PRSNA)) QUIT:PRSNA="" D
  1. . N X,Y,A,B,C,D
  1. . ;set x and x("r")
  1. . S A=PRSNPC(PRSNA),X=$E(A>2400*-2400+A+10000,2,5) D ^PRSATIM
  1. . S B=$P(A,U,2),C=$P(A,U,3),D=$P(A,U,4),B=$E(B>2400*-2400+B+10000,2,5)
  1. . S PRSNB=$S(",OT,CT,RG,"[C&(C]""):"V",1:""),PRSNC=$S(",WI,OT,CT,RG,HW,"'[C:"",$P(PRSNUR,U,4)="DC":$O(^PRSN(451.5,"B","DC",0)),1:"")
  1. . S X("DR")="1///"_B_";2////"_D_";3////"_C_";4////"_$P(PRSNLOC,U)_";5////"_PRSNC_";6////"_PRSNB_";8////"_$P(A,U)_";9////"_$P(A,U,2)
  1. . D ADD^PRSU1B1(.X,.Y,"451;;"_PPI_"~451.09;;"_DFN_"~451.99;;"_PRSNDAY_"~451.999;;"_PRSNVER_";~451.9999;^PRSN(451,PPI,""E"",DFN,""D"",PRSNDAY,""V"",PRSNVER,""T"",")
  1. . QUIT
  1. QUIT
  1. ;
  1. ;called from screenman form page 1 or page 1.5
  1. ;a=start time, b=stop time, c=1 if start time starts day 1, =2 if day 2
  1. MILSS(A,B,C) ;ef:^1-military start time, ^2-military stop time, ^3 invalid message
  1. N X,Y,D,E
  1. S D="",E=""
  1. I A'="" S Y=0,X=A D MIL^PRSATIM S D=C-1*2400+Y
  1. I B'="" S Y=1,X=B D MIL^PRSATIM S Y=C-1*2400+Y,E=Y S:Y'>D E=2400+Y
  1. QUIT D_"^"_E_"^"_$S(E>2400&(C=1):"Stop Time is in the Second Day of the tour. Its Type of Time must be OT/CT/RG.",E>4800&(C=2):"Stop Time is in the Third Day of the tour.",1:"")
  1. ;
  1. ;data validation check before save
  1. DATAVAL ;called from form for data validation
  1. N PRSNA,PRSNB,PRSNC,PRSND,PRSNE,PRSNERR,PRSNDIE,PRSNDA,PRSNTT,PRSNOTT,PRSNOTR,PRSNM
  1. S PRSNERR=0
  1. S PRSNDIE="^PRSN(451,"_PPI_",""E"","_DFN_",""D"","_PRSNDAY_",""V"","_PRSNVER_",""T"","
  1. S PRSNDA(4)=PPI,PRSNDA(3)=DFN,PRSNDA(2)=PRSNDAY,PRSNDA(1)=PRSNVER
  1. S PRSNDA=0
  1. F S PRSNDA=$O(^PRSN(451,PPI,"E",DFN,"D",PRSNDAY,"V",PRSNVER,"T",PRSNDA)) QUIT:'PRSNDA D
  1. . S PRSNA=$$GET^DDSVAL(PRSNDIE,.PRSNDA,.01)
  1. . S PRSNB=$$GET^DDSVAL(PRSNDIE,.PRSNDA,8)
  1. . S PRSNC=$$GET^DDSVAL(PRSNDIE,.PRSNDA,9)
  1. . S PRSNM=$$GET^DDSVAL(PRSNDIE,.PRSNDA,2)
  1. . S PRSNTT=$$GET^DDSVAL(PRSNDIE,.PRSNDA,3)
  1. . S PRSNOTT=$$GET^DDSVAL(PRSNDIE,.PRSNDA,6)
  1. . S PRSNOTR=$$GET^DDSVAL(PRSNDIE,.PRSNDA,7)
  1. . I PRSNTT'="",",OT,CT,RG,"[PRSNTT D
  1. .. I PRSNOTT="" S PRSNERR=PRSNERR+1,PRSNERR(PRSNERR)="Subrecord: "_PRSNA_" is missing overtime type"
  1. .. I PRSNOTR="" S PRSNERR=PRSNERR+1,PRSNERR(PRSNERR)="Subrecord: "_PRSNA_" is missing overtime reason"
  1. . I PRSNB=""!(PRSNC="") S PRSNERR=PRSNERR+1,PRSNERR(PRSNERR)="Subrecord: "_PRSNA_" has wrong Stop Time" QUIT
  1. . I $D(PRSNB(PRSNB)) S PRSNERR=PRSNERR+1,PRSNERR(PRSNERR)="Subrecord: "_PRSNA_" has duplicate Start Time" QUIT
  1. . S PRSNB(PRSNB)=PRSNC_"^"_PRSNA_"^"_PRSNM
  1. . QUIT
  1. S PRSNB=""
  1. F S PRSNB=$O(PRSNB(PRSNB)) QUIT:PRSNB="" D
  1. . S PRSNC=+PRSNB(PRSNB)
  1. . S PRSNM=$P(PRSNB(PRSNB),U,3)
  1. . I PRSNM,PRSNC\100*60+(PRSNC#100)-(PRSNB\100*60+(PRSNB#100))<PRSNM S PRSNERR=PRSNERR+1,PRSNERR(PRSNERR)="Meal Time is over Start/Stop Time."
  1. . S PRSND=$O(PRSNB(PRSNB))
  1. . S PRSNE=$O(PRSNB(PRSNC-1))
  1. . I PRSND'=PRSNE S PRSNERR=PRSNERR+1,PRSNERR(PRSNERR)="Subrecord: "_$P(PRSNB(PRSNB),U,2)_" has Stop Time greater than Start Time of the next time segment"
  1. . QUIT
  1. I PRSNERR D HLP^DDSUTL(.PRSNERR) S DDSERROR=1,DDSBR="1^2^1"
  1. QUIT