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

RMPRUTL2.m

Go to the documentation of this file.
  1. RMPRUTL2 ;PHX/HPL-Patient Letter Date look-up in chronological order ;05/22/1995
  1. ;;3.0;PROSTHETICS;;Feb 09, 1996
  1. EN1 ;entry point to ask patient
  1. I '$D(RMPR) D DIV4^RMPRSIT
  1. D GETPAT^RMPRUTIL Q:'$D(RMPRDFN)
  1. EN ;entry point pass RMPRDFN
  1. ;return RMPRPRIN as ien of 665.4 if a selection is made, otherwise
  1. ;RMPRIN is PASSED BACK AS -1.
  1. I $G(RMPRDFN)'>0 S:$G(DFN)>0 RMPRDFN=DFN D:$G(DFN)'>0 EN1^RMPRUTL2
  1. I '$D(^RMPR(665.4,"AH",RMPRDFN)) W !!,$C(7),?5,"NO LETTERS FOR THIS PATIENT!" S RMPRIN=-1 Q
  1. N RMPRBDT,DIC,RI,DR,RB,DA,RMPLET,DIQ,Y,RO
  1. S (RMPRBDT,RI,RB,RO)=0,RMPRIN=-1,DIC=665.4,DR=".01;1;2;4;11",DIQ="RMPRLET"
  1. W !!,"#",?5,"Patient",?28,"Type of letter",?45,"Employee"
  1. W ?65,"Date of letter"
  1. W !,RMPR("L")
  1. F S RMPRBDT=$O(^RMPR(665.4,"AH",RMPRDFN,RMPRBDT)) Q:RMPRBDT="" D Q:RO=1
  1. .;check for more than one letter per day
  1. .S DA=0
  1. .F S DA=$O(^RMPR(665.4,"AH",RMPRDFN,RMPRBDT,DA)) Q:'DA D Q:RO=1
  1. ..S RI=RI+1,RI(RI)=DA D EN^DIQ1 Q:'$D(RMPRLET)
  1. ..S RB=RB+1
  1. ..W !,RI
  1. ..W ?5,RMPRLET(665.4,DA,.01),?28,$G(RMPRLET(665.4,DA,1))
  1. ..W ?45,$E($G(RMPRLET(665.4,DA,4)),1,15)
  1. ..W ?65,$G(RMPRLET(665.4,DA,2))_$G(RMPRLET(665.4,DA,11))
  1. ..K RMPRLET
  1. ..I RB>4&(RMPRIN<1) D ASK Q:RMPRIN>0 S RB=0
  1. G:$D(DTOUT)!($D(DUOUT)) EXIT
  1. I RMPRIN'>0 S:'RI(RI) RI=RI-1 D ASK Q
  1. G EXIT
  1. Q
  1. ASK ;get record
  1. I RMPRBDT="",DA="" W !!,"End of Patient's Letter Listing."
  1. W !!,"Enter '^' to stop or "
  1. N DIR S DIR(0)="NO^1:"_RI_":0" D ^DIR
  1. I ($D(DTOUT))!($D(DUOUT)) S RO=1 Q
  1. I +Y>0 S RMPRIN=RI(Y),RO=1 Q
  1. Q
  1. EXIT ;common exit point
  1. K DTOUT,DUOUT,RMPRBDT
  1. Q