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

NURSEPD0.m

Go to the documentation of this file.
NURSEPD0 ;HIRMFO/JH,RM-INDIVIDUAL M I DEFICIENCY BY EMPLOYEE NAME ;2/27/98  14:27
 ;;4.0;NURSING SERVICE;**3,7,9,13,16**;Apr 25, 1997
EN1 S X=$G(^PRSE(452.7,1,"OFF")) Q:X=""!(X=1)
 S X=$G(^DIC(213.9,1,"OFF")) Q:X=""!(X=1)
 S (NUROUT,NURQUEUE,NURSW1)=0
 S DATSEL="NS^N+" D DATSEL^NURSAGP2 G:$D(POUT) QUIT
 D EN1^NURSAUTL G:NUROUT=1 QUIT D EN10^NURSUT3($G(DUZ))
 S SSN=$P(^VA(200,DUZ,1),U,9),NDA=$O(^PRSPC("SSN",SSN,0))
 I NDA'>0 D  G EN1
 .  W !!?5,"No SSN found for this user or, no entry for"
 .  W !?5,"this person in the PAID EMPLOYEE File (#450)."
 .  Q
 I $G(NURSZAP)>7 S DA=$O(^NURSF(210,"B",DUZ,0)) G A
NAME S DIC("S")="I '$D(^NURSF(210,""AC"",""R"",+Y)),+$$EN6^NURSUT3($G(Y))"
 D EN3^NURSAGP1 G:NUROUT!'(+Y>0) QUIT  S NDA=$P(Y,U,2)
 S SSN=$P($G(^VA(200,NDA,1)),U,9) S:SSN="" SSN=U
 S NDA=$O(^PRSPC("SSN",SSN,0))
 I NDA'>0 D  G NAME
 . W !!?5,"No SSN found for this person or, no entry for"
 . W !?5,"this person is found in the PAID EMPLOYEE File (#450)."
 . Q
A S NAM=$P($G(^PRSPC(NDA,0)),U)
 W ! S ZTRTN="START^NURSEPD0",ZTDESC="INDIVIDUAL M.I. DEFICIENCY by EMPLOYEE NAME" D EN7^NURSUT0 G:POP!($D(ZTSK)) QUIT
START ;DEFINE FISCAL YEAR DATE AND HEADERS FOR OUTPUT DATA REPORT
 K ^TMP("NURE",$J) U IO S (HOLD,COUNT)=0,NURS132=$S(IOM'<132:1,1:0)
 I (+NDA>0),$G(^PRSPC(NDA,0))'="" S SSN=$P(^PRSPC(NDA,0),U,9) I SSN'="" S VA200DA=$O(^VA(200,"SSN",SSN,0)) I VA200DA>0 D
 .W:$E(IOST)="C" "."
 .S DA=$O(^NURSF(210,"B",+VA200DA,0)) D EN3^NURSUT0 S NURNODE4=NOD1 I NURNODE4 D
 ..S NPWARD=$S($D(^NURSF(211.8,+NURNODE4,0))&+$P(^(0),U):$P(^(0),U),1:"")
 ..I '$D(NWRD)&('$D(NPWARD)) Q
 ..D EN7^NURSAUTL S NL1=$S(NPWARD="":"  BLANK",1:$E(NPWARD,1,9))
 ..S NSCT=$S($P(^NURSF(211.8,NURNODE4,0),U,2)="":"  BLANK",1:$P(^(0),U,2))
 ..S NAM=$P($G(^VA(200,VA200DA,0)),U),NAM=$S(NAM'="":NAM,1:"VA # "_VA200DA) K DROPDEAD
 ..S PRSPCD1=0 F  S PRSPCD1=$O(^PRSPC(NDA,6,PRSPCD1)) Q:PRSPCD1'>0  D
 ...S NURS=$G(^PRSPC(NDA,6,PRSPCD1,0)),CLASSIEN=+NURS Q:CLASSIEN'>0
 ...Q:$S($P(NURS,U,3)'>0:1,$P(NURS,U,3)>YREND:1,$P(NURS,U,3)>DT:1,1:0)
 ...S CLASS=$G(^PRSE(452.1,CLASSIEN,0)) Q:CLASS=""
 ...I $P(CLASS,U,7)'="M" Q  ; Only Mandatory Inservice
 ...S CLASSTXT=$P(CLASS,U),FREQ=+$P(CLASS,U,6)
 ...S CLASSTXT(0)=$S(NURS132:CLASSTXT,1:$E(CLASSTXT,1,25))
 ...S:CLASSTXT(0)="" CLASSTXT(0)="  BLANK"
 ...S DATE=+$O(^PRSE(452,"AA","M",VA200DA,CLASSTXT,0))
 ...I FREQ=0,DATE Q  ;ONE TIME ONLY CLASS
 ...S LASTDATE=$S(DATE:9999999-DATE\1,1:0)
 ...I $E(LASTDATE,6,7)="00" D
 ....N MONTH,YEAR
 ....S MONTH=+$E(LASTDATE,4,5),YEAR=1700+$E(LASTDATE,1,3)
 ....S LASTDAY=$S(YEAR#400=0:1,YEAR#4=0&'(YEAR#100=0):1,1:0)
 ....S LASTDAY=$P("31^"_(28+LASTDAY)_"^31^30^31^30^31^31^30^31^30^31",U,MONTH)
 ....S LASTDATE=$E(LASTDATE,1,5)_LASTDAY
 ....Q
 ...S X1=LASTDATE,X2=FREQ*365.25 D C^%DTC
 ...S DROPDEAD=X
 ...I DROPDEAD>YREND Q
 ...I DROPDEAD'<YRST,DROPDEAD'>YREND,DROPDEAD'<DT Q
 ...S:$G(NURSORT)="" NURSORT=1
 ...N X S X=$G(^TMP("NURE",$J,"L",NL1,CLASSTXT))
 ...I X="" S X=NURSORT,NURSORT=NURSORT+1,^TMP("NURE",$J,"L",NL1,CLASSTXT)=X
 ...S ^TMP("NURE",$J,"L1",X,NSCT,NAM,DA)=DROPDEAD
 I $O(^TMP("NURE",$J,"L",""))="" D HDR^NURSEPD1 W !,NAM_" HAS NO DEFICIENCIES FOR THIS PERIOD" G QUIT
 I $O(^PRSPC(NDA,6,0))="" D HDR^NURSEPD1 W !,NAM_" HAS NO GROUPS/CLASSES ASSIGNED" G QUIT
 S NL1="" F  S NL1=$O(^TMP("NURE",$J,"L",NL1)) Q:NL1=""!(NUROUT)  S HOLD=1,CLASSTXT="" F  S CLASSTXT=$O(^TMP("NURE",$J,"L",NL1,CLASSTXT)) Q:CLASSTXT=""!(NUROUT)  S NURSORT=$G(^TMP("NURE",$J,"L",NL1,CLASSTXT)) I NURSORT D
 .S NSCT="" F NSCT=$O(^TMP("NURE",$J,"L1",NURSORT,NSCT)) Q:NSCT=""!NUROUT  S NAM="" F  S NAM=$O(^TMP("NURE",$J,"L1",NURSORT,NSCT,NAM)) Q:NAM=""!(NUROUT)  S PRDA=0 F  S PRDA=$O(^TMP("NURE",$J,"L1",NURSORT,NSCT,NAM,PRDA)) Q:PRDA'>0!(NUROUT)  D
 ..D:($Y>(IOSL-4))!'(NURSW1) HDR^NURSEPD1 Q:NUROUT
 ..S DROPDEAD=$G(^TMP("NURE",$J,"L1",NURSORT,NSCT,NAM,PRDA))
 ..W ! W:HOLD=1 $S(NURS132:NAM,1:$E(NAM,1,30))
 ..S NSCT(1)=$S(NSCT="C":"CK",NSCT="L":"LPN",NSCT="R":"RN",NSCT="O":"OT",NSCT="S":"SE",NSCT="A":"AO",NSCT="N":"NA",1:" ") W:HOLD=1 "  "_NSCT(1)
 ..W:NL1'="  BLANK"&HOLD=1 ?$S(NURS132:46,1:25),$E(NL1,1,$S(NURS132:22,1:14))
 ..W:$G(DROPDEAD)>0 ?$S(NURS132:57,1:35),$$FMTE^XLFDT(DROPDEAD,2)
 ..W:CLASSTXT'="  BLANK" ?$S(NURS132:79,1:47),$S(NURS132:CLASSTXT,1:$E(CLASSTXT,1,33))
 ..S HOLD=0
QUIT ; KILL ALL LOCAL VARIABLES
 K ^TMP("NURE",$J) D CLOSE^NURSUT1,^NURSKILL
 K NTODAY,NSTATUS Q