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

PRSNRUT1.m

Go to the documentation of this file.
  1. PRSNRUT1 ;WOIFO/DAM - API Pull POC Data;060409
  1. ;;4.0;PAID;**126**;Sep 21, 1995;Build 59
  1. ;;Per VHA Directive 2004-038, this routine should not be modified
  1. ;
  1. ;INPUT:
  1. ; PPIEN: Pay period IEN is in TIME & ATTENDANCE RECORDS file (#458)
  1. ; The .01 field is the pay period, eg "09-07"
  1. ; and matches the .01 field in
  1. ; POC DAILY TIME RECORDS file (#451)
  1. ; The IEN is in the 2nd subscript and B xref of
  1. ; the .01 field in file (#458)
  1. ; PRSIEN: Nurse IEN is the .01 field in the POC DAILY TIME RECORDS
  1. ; file (#451) multiple 451.09
  1. ; PRSNDAY: Day number is the .01 field in POC DAILY TIME RECORDS
  1. ; file (#451) multiple 451.99. This parameter is optional.
  1. ; If a DAY is not passed in, results for the entire pay
  1. ; period are returned.
  1. ; PRSNVER: "C" or "P" to retrieve Current or Previous version of time record
  1. ;
  1. ;OUTPUT:
  1. ; Returns array POCD(N)="Start Time^Stop Time^Meal Time
  1. ; ^Type of Time^Point of Care^Type of Work^Mandatory Indicator
  1. ; ^Reason for OT/CT/RG"
  1. ;
  1. L1(POCD,PPIEN,PRSIEN,PRSNDAY,PRSNVER) ;EMPLOYEE
  1. ;Called from PRSNRUT0
  1. ;
  1. S PRSNVER=$G(PRSNVER,"C")
  1. S POCD(0)=0
  1. N N
  1. S N=1
  1. N PRSND0,PRSND1,PRSND2,PRSND3,PRSND4
  1. S PRSND0=PPIEN
  1. S PRSND1=0
  1. F S PRSND1=$O(^PRSN(451,PRSND0,"E",PRSND1)) Q:PRSND1'>0 D
  1. . I $P($G(^PRSN(451,PRSND0,"E",PRSND1,0)),U,1)=PRSIEN D
  1. . . D L2(.POCD,PRSND0,PRSND1,PRSNDAY,PRSNVER)
  1. Q
  1. ;
  1. L2(POCD,PRSND0,PRSND1,PRSNDAY,PRSNVER) ;Loop through DAY entries
  1. ;
  1. S PRSNVER=$G(PRSNVER,"C")
  1. S PRSND2=0
  1. F S PRSND2=$O(^PRSN(451,PRSND0,"E",PRSND1,"D",PRSND2)) Q:'PRSND2 D
  1. . I $P(^PRSN(451,PRSND0,"E",PRSND1,"D",PRSND2,0),U,1)=PRSNDAY D
  1. .. D L3(.POCD,PRSND0,PRSND1,PRSND2,PRSNVER)
  1. . I PRSNDAY="" D L3(.POCD,PRSND0,PRSND1,PRSND2,PRSNVER)
  1. Q
  1. ;
  1. L3(POCD,PRSND0,PRSND1,PRSND2,PRSNVER) ;Loop through VERSION entries
  1. ;
  1. S PRSNVER=$G(PRSNVER,"C")
  1. S PRSND3=99999
  1. S PRSND3=$O(^PRSN(451,PRSND0,"E",PRSND1,"D",PRSND2,"V",PRSND3),-1)
  1. Q:PRSND3=""
  1. I PRSNVER="P" S PRSND3=$O(^PRSN(451,PRSND0,"E",PRSND1,"D",PRSND2,"V",PRSND3),-1)
  1. Q:PRSND3=""
  1. D L4(.POCD,PRSND0,PRSND1,PRSND2,PRSND3)
  1. Q
  1. ;
  1. L4(POCD,PRSND0,PRSND1,PRSND2,PRSND3) ;RETURN DATA
  1. ;
  1. S PRSND4=0
  1. F S PRSND4=$O(^PRSN(451,PRSND0,"E",PRSND1,"D",PRSND2,"V",PRSND3,"T",PRSND4)) Q:'PRSND4 D
  1. . S POCD(N)=$P(^PRSN(451,PRSND0,"E",PRSND1,"D",PRSND2,"V",PRSND3,"T",PRSND4,0),U,1,10)
  1. . S $P(POCD(N),U,11)=PRSND3
  1. . S POCD(0)=N
  1. . S N=N+1
  1. ;If there is at least one time segment then we are done
  1. Q:N>1
  1. ;Otherwise, update version number here for deleted time records
  1. S $P(POCD(N),U,11)=PRSND3
  1. S POCD(0)=N
  1. ;
  1. Q