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

RMPR37.m

Go to the documentation of this file.
RMPR37 ;PHX/HNC,JLT-POST AN ECMS 2237 TO 10-2319 ;8/29/1994
 ;;3.0;PROSTHETICS;**6,34,35,41,62,130,185**;Feb 09, 1996;Build 19
 ;Per VHA Directive 10-93-142, this routine should not be modified.
 ;
 ;RVD patch #62 - PCE interface
 ;    patch #130 - Routine temporarily removed from Prosthetics
 ;DDA patch #185 - Reinstated for eCMS/IFCAP purchase requests
 ;
 K ^TMP($J,"RMPRPCE")
 D DIV4^RMPRSIT G:$D(X) EXIT
OBL ;get obligation number
 S DIC("S")="I $P(^(0),U,4)>1&($P(^(0),U,4)<5)"
 S DIC(0)="EQZ",DIC="^PRCS(410,"
 S DIC("A")="Select OBLIGATION NUMBER: "
 K R410
 D ^PRCSDIC G:Y'>0 EXIT
 I $P(Y(0),U,2)="CA" W !!,$C(7),?5,"OBILIGATION TRANSACTION CANCELED",! G OBL
 S RMPR2237=$P(Y,"^",2)
 S %X=DIC_+Y_",",%Y="R410(" D %XY^%RCR K %X,%Y,DIC
 ; CHECK FOR eCMS ACTIONID
 S RMPREAID=$P(R410(1),U,8)
 S RMPRPO=$P(R410(4),U,5)
 I RMPRPO="" W !!,$C(7),?5,"**WARNING -- THIS 2237 DOES NOT HAVE AN IFCAP PURCHASE ORDER **",!
DSP ;display obligation line items
 K RIT,RIB D HOME^%ZIS W @IOF K RIT,FL,RD
DSP0 ;DISPLAY BUT WITHOUT CLEARING THE SCREEN.
 S (CTT,ITN,LCT,PCT)=0 F  S ITN=$O(R410("IT",ITN)) Q:ITN'>0  S LCT=LCT+1 D A^RMPR37A
 I LCT=PCT W !,"All lines of this 2237 have been posted.",! H 5 G OBL
ASK ;ask item to post 
 S X=CTT D COMMA^%DTC
 W !?34,"TOTAL EST. COST:  ",X
 S X=$P(R410(4),U,3) D COMMA^%DTC
 W !?34,"OBLIGATED AMOUNT: ",X S D1=0 W !,"REMARKS:",!
 F  S D1=$O(R410("RM",D1)) Q:D1'>0  W !,R410("RM",D1,0)
 W !!,"VENDOR: ",$P(R410(2),U,1)
 K DIR
 S DIR("?")="Enter the Line Item # you wish to post."
 W ! S DIR(0)="N^1:"_LCT
 S DIR("A")="Please enter Line Item #"
 D ^DIR
 I '$D(DTOUT),'$D(DIRUT),$D(X) S (RMPRY,RZ)=X
 I $D(DTOUT)!($D(DIRUT))!(Y=-1) W !,"Please Try Later!" G OBL
 S RMPRIT=+Y,RMPREIID="" K X,Y,DA
 I $D(R410("IT",RMPRIT,4)) S RMPREIID=$P(R410("IT",RMPRIT,4),U,3)
 I RMPREIID="" S RMPREIID=RMPR2237_"-"_RMPRIT
 I $D(^RMPR(660,"EIID",RMPREIID)) W !!,"**  LINE ITEM UNIQUE ID "_RMPREIID_" has already been posted!  **",!! G DSP0
PAT ;get patient
 D GETPAT^RMPRUTIL G:'$D(RMPRDFN) KILL
 K DIR,DA S DIR(0)="660,2",DIR("B")="INITIAL ISSUE" D ^DIR G:$D(DIRUT) KILL S (RMTYPE,RMPRTYP)=Y K X,Y
 K DIR,DA S DIR(0)="660,62" D ^DIR G:$D(DIRUT) KILL S RMPRCAT=Y,RMPRSC="" K X,Y
 I RMPRCAT=4 K DIR,DA S DIR(0)="660,63" D ^DIR G:$D(DIRUT) KILL S RMPRSC=Y K X,Y
 S RMPR661="" I $P(R410("IT",RMPRIT,0),U,5)'="" S RMPR661=$O(^RMPR(661,"B",$P(R410("IT",RMPRIT,0),U,5),""))
 I RMPR661'="" S C=$P(^DD(660,4,0),U,2),Y=RMPR661 D Y^DIQ S RMPR661T=Y K C,Y
 I RMPR661'="" K DIR,DA S DIR(0)="660,4",DIR("A")="ITEM",DIR("B")=RMPR661T D ^DIR G:$D(DIRUT) KILL S RMPR661=+Y K X,Y
 I RMPR661="" K DIR,DA S DIR(0)="660,4",DIR("A")="ITEM" D ^DIR G:$D(DIRUT) KILL S RMPR661=+Y K X,Y
 K DIR,DA S DIR(0)="660,4.5" D ^DIR G:$D(DIRUT) KILL S RMPRHC=+Y K X,Y
 S RDA=RMPRHC_"^"_RMTYPE_"^C^"_660
 D CPT^RMPRCPTU(RDA)
 S RMPRV=$P(R410(2),U)
 S RMPRQTY=$S($D(R410("IT",RMPRIT,0)):$P(R410("IT",RMPRIT,0),U,2),1:1)
 K DIR,Y,X S DIR(0)="660,9^O" D ^DIR G:$D(DTOUT)!($D(DUOUT)) KILL S RMPRSN=Y K X,Y
 K DIR,Y,X S DIR(0)="660,21" D ^DIR G:$D(DTOUT)!($D(DUOUT)) KILL S RMPRLT=Y K X,Y
AB S %=1 R !,"Would you like to POST this request now" D YN^DICN
 G:%<0 KILL G:%=0 H G:%=1 POST G:%=2 KILL
POST W !," Posting Now ..."
 S DIC="^RMPR(660,",DIC(0)="AEQLM",DLAYGO=660,X=DT
 S DIC("DR")=".02////^S X=RMPRDFN"
 K DINUM,DD,DO D FILE^DICN K DLAYGO
 I Y=-1 W !!,"*** Request failed to post.  Please contact support. ***" H 10 G EXIT
 S ^RMPR(660,+Y,0)=DT_U_RMPRDFN_U_$P(R410(1),U)_U_RMPRTYP_"^^"_RMPR661_U_RMPRQTY_U_$P(R410("IT",RMPRIT,0),U,3)_U_$P($G(R410(3)),U,4)_U_RMPR("STA")_U_RMPRSN_U_DT_"^3^C^^"_($P(R410("IT",RMPRIT,0),U,7)*RMPRQTY)_"^^^^^^^^"_RMPRLT,RMPRA=+Y
 S ^RMPR(660,+Y,1)=$P(R410(0),U,1)_"^^^"_$G(RMPRHC)_"^^"_RMCPT
 S $P(^RMPR(660,+Y,0),U,27)=DUZ
 ; S two new eCMS ID fields
 S ^RMPR(660,+Y,5)="^"_RMPREAID_"^"_RMPREIID
 S ^RMPR(660,+Y,"AM")="^^"_RMPRCAT_U_RMPRSC
 K RMPRG L +^RMPR(669.9,RMPRSITE,0):999 I $T=0 S RMPRG=DT-99
 I '$D(RMPRG) S RMPRG=$P(^RMPR(669.9,RMPRSITE,0),U,7),RMPRG=RMPRG-1,$P(^RMPR(669.9,RMPRSITE,0),U,7)=RMPRG L -^RMPR(669.9,RMPRSITE,0)
 S ^RMPR(660,+Y,"AMS")=RMPRG
 Q:'$D(R410("IT"))  S D1=0 F  S D1=$O(R410("IT",RMPRIT,1,D1)) Q:D1'>0  S RZI(RMPRIT_D1)=R410("IT",RMPRIT,1,D1,0)
 S D1=0 F I=1:1 S D1=$O(RZI(D1)) Q:D1'>0  S ^RMPR(660,+Y,"DES",I,0)=RZI(D1)
 S:RMPREAID'="" ^RMPR(660,+Y,"DES",I,0)=" eCMS ACTIONUID is "_RMPREAID_"/ eCMS ITEMUID is "_RMPREIID
 S ^RMPR(660,+Y,"DES",0)="^660.028^"_I_U_I,DIK=DIC,(RMPR660,DA)=+Y
 D IX1^DIK
 W !?5,"Updated 10-2319 Record"
 ;added in patch #62
 S ^TMP($J,"RMPRPCE",660,RMPR660)=RMPRG_"^"_$G(RMPRDFN)
 D LINK^RMPRS
 G DSP
H W !,"Enter `Y` for YES if you want to post this request to the Patient's 10-2319 Record." G AB
 ;KILL VARS BUT RETURN TO DSP0, LINE SELECTION PROMPT
KILL W !,$C(7),"** Did Not POST 2237 to Veterans 2319 Record! **" K RMPRIT,RMPREIID,RMTYPE,RMPRTYP,RMPRCAT,RMPRSC,RMPRHC,RMPRV,RMPRQTY,RMPRSN G DSP0
 ;KILL VARS AND EXIT
EXIT K ITN,RZZZ,RG,D1,DIK,DIR,DIRUT,DTOUT,DUOUT,I,RMPRCNT,RMPRSEL,DA,RMPRA,RMPRDFN,UN,X,X2,R410,CTT,RTN,RMPRV,RMPRQTY,DIC,Y,RMPRTYP,PRC,RMPRIT,RMPRCAT,RMPRSC,RD,RC,RIT,RIN,RZ,RT,RF,RE,RNI,CI,AZL,RIB,RMPRSN
 K RMPR660,RMPR661,RMCHK,RMPREAID,LCT,PCT,RMPR2237,RMPRPO
 K ^TMP($J,"RMPRPCE")
 K PRCSIP,RAT,RZI,KI,C1,GI,KK,RB,RI,RJ,RXX,RMPRHC,RMPRY,RMPRDOB,RMPRNAM,RMPRSSN,RMPRG,N,RMCPT,RMTYPE,RDA,RMPRCNUM,RMPRSSNE,RRX,PRCFLAG,TYPE Q