source: FOIAVistA/trunk/r/PROSTHETICS-RMPR-RMPO-RMPS/RMPOLF1.m@ 1397

Last change on this file since 1397 was 628, checked in by George Lilly, 15 years ago

initial load of FOIAVistA 6/30/08 version

File size: 3.2 KB
Line 
1RMPOLF1 ;HIN CIOFO-DRIVER FOR HO LETTERS ;7/8/98
2 ;;3.0;PROSTHETICS;**29**;Feb 09, 1996
3NAME ;
4 S RMPRNAME=$P(RMPRNAME," ",1,2) K RMPRVIEW,RMPRPRIN
5 I $P(VADM(5),U)["M" S ^TMP($J,"DW",19,0)="|TAB|"_"Dear Mr. "_RMPRNAME_":"
6 E S ^TMP($J,"DW",19,0)="|TAB|"_"Dear Ms. "_RMPRNAME_":"
7 S RV=21 F RI=0:0 S RI=$O(^RMPR(665.2,RMPRFA,1,RI)) Q:RI'>0 Q:^(RI,0)'=" "
8 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,"DW",RV,0)=TAB_^(0),RV=RV+1
9 I $G(RMPRTFLG) G SETALL^RMPOLF2
10EDIT S DIC="^TMP($J,""DW""," D EN^DIWE S RMPRFLAG=1
11EDIT1 S %=1 W !,"Do you wish to view this letter" D YN^DICN
12 I %<0 G END
13 I %=0 W !,"Answer `YES` to view the letter, `NO` to not" G EDIT1
14 I %=1 G:$G(RMPRPRIN)'="" PRINT S RMPRPRIN=1,RMPRVIEW=1 G SET^RMPOLF2
15ASK ;
16 S %=1 W !,"Do you wish to accept this letter" D YN^DICN
17 I %<0 G END
18 I %=0 W !,"Answer `YES` or `NO`" G ASK
19 I %=2 G ASK2
20 K RMPRVIEW G:$D(RMPRPRIN) PRINT G SET^RMPOLF2
21ASK2 ;DECIDES TO KEEP EDITING LETTER OR DELETE IT
22 ; ALREADY SAID NOT TO ACCEPT LETTER
23 S %=2 W !,"Do you wish to Delete this letter" D YN^DICN
24 I %=1!(%<0) D Q
25 .I $G(RMPRIN)'>0 W $C(7),!!,?35,"Letter Deleted..." D END Q
26 .I $D(^RMPR(665.4,RMPRIN,0)) D DEL^RMPOLF1
27 .W $C(7),!!,?35,"Deleted..." H 1 Q
28 I %=0 W !,"Enter `YES` to Delete this letter" G ASK2
29 G EDIT
30 ;
31PRALL ;print all letter
32 S DIC="^RMPR(665.4,",RMPRPG=0,DHD="[RMPR BLANK]-[RMPR PAGE]"
33 S ZTSAVE("^TMP(""RL"",$J,")=""
34 S DIS(0)="I $D(^TMP(""RL"",$J,1,D0))"
35 S BY="@NUMBER",(TO,FR)="",FLDS="3",L=0,PG=2,DHIT="W @IOF"
36 D EN1^DIP
37 Q
38 ;
39PRINT ;VIEW LETTER
40 I $G(RMPRIN)'>0 Q:$G(RMPRDA)'>0 S RMPRIN=RMPRDA
41 S DFN=$P(^RMPR(665.4,RMPRIN,0),U)
42 S RMPRTY=$P(^RMPR(665.4,RMPRIN,0),U,2)
43 S RMPR1=^RMPR(665.2,RMPRTY,0)
44 S DIC="^RMPR(665.4,",RMPRPG=0,DHD="[RMPR BLANK]-[RMPR PAGE]"
45 S BY="@NUMBER",FR=RMPRIN,TO=RMPRIN,FLDS="3",L=0,PG=2
46 ;next line is needed, if not a HOME device.
47 D EN1^DIP I '$D(POP) S POP=0
48 I POP S RMPRGO=$S($D(^RMPR(665.4,RMPRIN,0)):"DEL^RMPOLF1",1:"END^RMPOLF1") D @RMPRGO W ?9," Deleted..." S RMQUIT=1 Q
49 G:$G(RMPRVIEW) ASK ;if only a view, go back and ask user to ACCEPT.
50EXIT ;common exit point
51 ;unlock letter and sets printed date and flag for the patient entry.
52 L:$D(RMPRIN) -^RMPR(665.4,RMPRIN,0)
53 S RMC=$S(RMPOLCD="A":"RMPOXBAT1",RMPOLCD="B":"RMPOXBAT2",RMPOLCD="C":"RMPOXBAT3",1:"") Q:RMC=""
54 S DA(1)=RMPOXITE,DIK="^RMPR(669.9,"_RMPOXITE_","_""""_RMC_""""_","
55 S DA=RMDA D ^DIK S RMPRNT=1
56 S RMPI=$S(RMPOLCD="A":9,RMPOLCD="B":11,RMPOLCD="C":13,1:"")
57 I RMPI S $P(^RMPR(665,DFN,"RMPOA"),U,RMPI)=DT,$P(^RMPR(665,DFN,"RMPOA"),U,RMPI+1)="P"
58 K ^TMP("RL",$J,RMPOXITE,"RMPOLST",RMPOLCD,RMPONAM)
59 K ^TMP("RL",$J,RMPOXITE,"LTR",RMPONAM)
60 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
61 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
62 K DIK,RMC,DA D ^%ZISC
63 Q
64DEL I $D(RMPRDELE) S %=2 W !,"Are you sure you want to delete this letter" D YN^DICN I %=0 W !,"Answer `YES` to Delete the letter, `NO` to exit" G DEL
65 I $D(RMPRDELE),(%<0!(%=2)) G EXIT
66 S DIK="^RMPR(665.4,",DA=RMPRIN D ^DIK G EXIT
67END Q
Note: See TracBrowser for help on using the repository browser.