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

RMPRFO1.m

Go to the documentation of this file.
RMPRFO1 ;PHX/RFM,HPL-DRIVER FOR PROSTHETIC LETTERS ;3/17/03  12:19
 ;;3.0;PROSTHETICS;**8,44,77,105**;Feb 09, 1996
 ;RVD 3/17/03 patch #77 - remove link to suspense from letter module.
NAME ;
 S RMPRNAME=$P(RMPRNAME," ",1,2)
 I $P(VADM(5),U)["M" S ^TMP($J,1,16,0)="|TAB|"_"Dear Mr. "_RMPRNAME_":"
 E  S ^TMP($J,1,16,0)="|TAB|"_"Dear Ms. "_RMPRNAME_":"
 S RV=18 F RI=0:0 S RI=$O(^RMPR(665.2,RMPRFA,1,RI)) Q:RI'>0  Q:^(RI,0)'=" "
 S RI=RI-1 F  S RI=$O(^RMPR(665.2,RMPRFA,1,RI)) Q:RI'>0  S TAB=$S($P(^RMPR(665.2,RMPRFA,1,RI,0),U)["|TAB|":"",1:"|TAB|") S ^TMP($J,1,RV,0)=TAB_^(0),RV=RV+1
EDIT S DIC="^TMP($J,1," D EN^DIWE S RMPRFLAG=1
EDIT1 S %=1 W !,"Do you wish to view this letter" D YN^DICN
 S RMPRAA68=% I RMPRAA68<0 G EXIT^RMPRFO1
 I RMPRAA68=0 W !,"Answer `YES` to view the letter, `NO` to not" G EDIT1
 I RMPRAA68=1 S RMPRFFL=1 G:$G(RMPRPRIN)'="" PRINT S RMPRPRIN=1 G SET^RMPRFO2
ASK ;
 S %=1 W !,"Do you wish to accept this letter" D YN^DICN
 S RMPRAA68=% I RMPRAA68<0 G EXIT^RMPRFO1
 I RMPRAA68=0 W !,"Answer `YES` or `NO`" G ASK
 I RMPRAA68=2 G ASK2
 K RMPRFFL G:$D(RMPRPRIN) PRINT G SET^RMPRFO2
ASK2 ;DECIDES TO KEEP EDITING LETTER OR DELETE IT
 ; ALREADY SAID NOT TO ACCEPT LETTER
 S %=2 W !,"Do you wish to Delete this letter" D YN^DICN
 S RMPRAA68=% I RMPRAA68=1!(RMPRAA68<0) D  Q
 .I $G(RMPRIN)'>0 W $C(7),!!,?35,"Letter Deleted..." D EXIT^RMPRFO1  Q
 .I $D(^RMPR(665.4,RMPRIN,0)) D DEL^RMPRFO1
 .W $C(7),!!,?35,"Deleted..." H 1 Q
 I RMPRAA68=0 W !,"Enter `YES` to Delete this letter" G ASK2
 G EDIT
EN2 ;PRINT/DELETE A LETTER
 K DIC D DIV4^RMPRSIT I $D(Y),(Y<0) G EXIT
 D HOME^%ZIS S DIC=2,DIC(0)="AEQMZ",DIC("A")="Select PATIENT: "
DICW ;CHOOSE THE LETTER TO PRINT
 ;S DIC("W")="S (RMPRDFN,DFN)=+Y" D ^DIC K DIC G:Y<0 EXIT
 D ^DIC K DIC G:Y<0 EXIT S (RMPRDFN,DFN)=+Y
 D EN^RMPRUTL2 Q:RMPRIN=-1  S:$G(RMPRIN)>0 DA=RMPRIN
 Q:$G(DA)<1  Q:$G(DA)=""  S RMPRIN=DA
 Q:$G(RMPRIN)'>0  S RMPRTY=$P(^RMPR(665.4,RMPRIN,0),U,2) L +^RMPR(665.4,RMPRIN,0):1 I $T=0 W !,?5,$C(7),"Someone else is Editing this entry!" G EXIT
 G:$D(RMPRDELE) DEL
 S DA=RMPRIN,ITMFLG=0 S:$D(^RMPR(665.4,DA,3,0)) ITMFLG=$P(^RMPR(665.4,DA,3,0),U,4) S:ITMFLG>4 ITMFLG=1
 S ITM=RMPRIN
 I $P(^RMPR(665.2,RMPRTY,0),U,3) D PRNT1^RMPRFO3 K RMPRTY,DA,ITM,ITMFLG D EXIT^RMPRFO3 G EXIT
PRINT ;VIEW LETTER
 I $G(RMPRIN)'>0 Q:$G(RMPRDA)'>0  S RMPRIN=RMPRDA
 S DFN=$P(^RMPR(665.4,RMPRIN,0),U)
 S RMPRTY=$P(^RMPR(665.4,RMPRIN,0),U,2)
 S RMPR1=^RMPR(665.2,RMPRTY,0)
 I $P(^RMPR(665.2,RMPRTY,0),U,3) S DA=RMPRIN K RMPR1 G PRNT1^RMPRFO3
 S DIC="^RMPR(665.4,",RMPRPG=0,DHD="[RMPR BLANK]-[RMPR PAGE]"
 S BY="@NUMBER",FR=RMPRIN,TO=RMPRIN,FLDS="3",L=0,PG=2
 D EN1^DIP I '$D(POP) S POP=0
 I POP,$D(RMPRFFL) S RMPRGO=$S($D(^RMPR(665.4,RMPRIN,0)):"DEL^RMPRFO1",1:"EXIT^RMPRFO1") D @RMPRGO W ?9," Deleted..." G EXIT
 ;I '$D(RMPRFFL),'$D(RNSK) S RMPRDFN=DFN D LINK^RMPRS G EXIT
 ;I 'POP,'$D(RMPRFFL),'$D(RNSK) S RMPRDFN=DFN K DIR S DIR(0)="E" W ! D ^DIR,LINK^RMPRS G EXIT
VI I $D(RMPRFFL) R !!,"Enter `return` to continue: ",X:DTIME G:'$T EXIT I X'="" W $C(7),!,"You may only enter `return` here.." G VI
 I $D(RMPRFFL) S DIE="^RMPR(665.4,",DA=RMPRIN,DR=3,DIE("NO^")="" D ^DIE G:$D(DTOUT)!($D(DUOUT)) EXIT G EDIT1
EXIT ;common exit point
 L:$D(RMPRIN) -^RMPR(665.4,RMPRIN,0)
 K ^TMP($J,1),^TMP($J,"RMPR")
 K %X,RMPRFFL,RMPRHED,RMPRPRIN,%Y,RMPRDEL,RMPRRVA,DIC,RMPRFA,KILL,DIE,DA,DR,DIK,RMPR1,RMPR2,RMPRDATE,RMPRIN,RMPRL,RMPRNAME,RMPRU,RMPRDELE,FR,RI,RV
 I '$D(RMPRCOMB)!('$D(RMPRFF)) K RMPREND,VADM,VAPA,VA,NAME,RMPRGO,NAME1,RMPRDEN,RMPRFLAG,RMPRNAM1,RMPRNAM2,RMPRFF,J,RP,RO,RZ D KVAR^VADPT
 D ^%ZISC Q
DEL I $D(RMPRDELE) S %=2 W !,"Are you sure you want to delete this letter" D YN^DICN S RMPRAA68=% I RMPRAA68=0 W !,"Answer `YES` to Delete the letter, `NO` to exit" G DEL
 I $D(RMPRDELE),(RMPRAA68<0!(RMPRAA68=2)) G EXIT
 S DIK="^RMPR(665.4,",DA=RMPRIN D ^DIK G EXIT