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

RMPRE29.m

Go to the documentation of this file.
  1. RMPRE29 ;PHX/JLT,RVD-EDIT 2319 ;10/2/03 13:04
  1. ;;3.0;PROSTHETICS;**36,41,51,57,62,74,81,61,145,150,180,189,192**;Feb 09, 1996;Build 1
  1. ; Per VA Directive 6402, this routine should not be modified.
  1. ;RVD patch #62 - call PCE API to update patient care encounter.
  1. ; - add a screen display if no changes to the HCPCS.
  1. ;RVD patch #74 - call $$STATCHK^ICPTAPIU to check if CPT Code is
  1. ; active for a given date.
  1. ;RVD patch #81 - roll back patch RMPR*3.0*74 and returns the screen
  1. ; to the STATUS field of file #661.1.
  1. ;RVD patch #61 - added screen not to process stock issue entries.
  1. ;uses DBIA # 1995 & 1997.
  1. ;
  1. ;RB patch 180 - Add model # and Contract # to editing capability
  1. ;
  1. W ! S DIC="^RMPR(660,",DIC(0)="AEMQZ",DIC("A")="Select PATIENT: "
  1. S DIC("W")="D EN^RMPRD1",RMEND=0
  1. S DIC("S")="I ($P(^(0),U,6)!($P(^(0),U,26)'="""")),($P(^(0),U,13)'=11)" W !
  1. D ^DIC G:+Y'>0 EXIT L +^RMPR(660,+Y,0):1 I $T=0 W !,?5,$C(7),"Someone else is Editing this entry!" G EXIT
  1. ;S (RMPRDA,DA)=+Y,DIE=DIC,DR="[RMPRE2319]" D ^DIE L -^RMPR(660,DA,0)
  1. S DIE=DIC,(RMPRDA,DA)=+Y
  1. TYP1 ;edit type of transaction....
  1. S R1(0)=$G(^RMPR(660,RMPRDA,0)),R1(1)=$G(^(1)),R1("AM")=$G(^("AM"))
  1. S RMTOTCOS=$P(R1(0),U,16)
  1. S (RMHCPC,RMHCOLD)=$P(R1(1),U,4),(RMTYPE,RMTYPS)=$P(R1(0),U,4),(RMCAT,RMCATS)=$P(R1("AM"),U,3),(RMSPE,RMSPES)=$P(R1("AM"),U,4),RMSOUR=$P(R1(1),U,14)
  1. TRAN K DIR S DIR(0)="660,2"
  1. ;S DIR("A")="Enter Type of Transaction: "
  1. S:$D(RMTYPS) DIR("B")=$S(RMTYPS="I":"INITIAL",RMTYPS="X":"REPAIR",RMTYPS="R":"REPLACE",RMTYPS="S":"SPARE",1:"")
  1. D ^DIR
  1. I $D(DUOUT)!$D(DTOUT) S RMEND=1 D SETED2 G QED2
  1. I Y="" W !,"Please enter type of Transaction!!" G TRAN
  1. S $P(R1(0),U,4)=Y,RMTYPE=Y
  1. S RMTYPS=$S(Y="I":"INITIAL",Y="X":"REPAIR",Y="R":"REPLACE",Y="S":"SPARE",1:"")
  1. PCAT K DIR S DIR(0)="660,62"
  1. S:$D(RMCATS) DIR("B")=$S(RMCATS=1:"SC/OP",RMCATS=2:"SC/IP",RMCATS=3:"NSC/IP",RMCATS=4:"NSC/OP",1:"")
  1. D ^DIR
  1. I $D(DUOUT)!$D(DTOUT) S RMEND=1 D SETED2 G QED2
  1. I Y="" W !,"Please enter Patient Category!!" G PCAT
  1. S RMCAT=Y
  1. S $P(R1("AM"),U,3)=Y,RMCATS=$S(Y=1:"SC/OP",Y=2:"SC/IP",Y=3:"NSC/IP",Y=4:"NSC/OP",1:"")
  1. K DIR I RMCAT<4 S $P(R1("AM"),U,4)="" G HCPC
  1. S DIR(0)="660,63"
  1. S:$D(RMSPES) DIR("B")=$S(RMSPES=1:"SPECIAL LEGISLATION",RMSPES=2:"A&A",RMSPES=3:"PHC",RMSPES=4:"ELIGIBILITY REFORM",1:"")
  1. I RMCAT=4 D ^DIR I $D(DUOUT)!$D(DTOUT) S RMEND=1 D SETED2 G QED2
  1. I RMCAT=4 S $P(R1("AM"),U,4)=Y,RMSPE=Y,RMSPES=$S(Y=1:"SPECIAL LEGISLATION",Y=2:"A&A",Y=3:"PHC",Y=4:"ELIGIBILITY REFORM",1:"")
  1. K DIR
  1. ;
  1. HCPC ;set type and ask item and HCPCS
  1. D SETED2
  1. ;ask source
  1. N SRC
  1. S SRC=$P(R1(0),U,14)
  1. S DIE("NO^")="BACK"
  1. S DR="12;4;4.5" D ^DIE
  1. K DIE("NO^")
  1. I $D(DUOUT)!$D(DTOUT)!$D(Y) S RMEND=1 G QED2
  1. S R1(0)=$G(^RMPR(660,RMPRDA,0)),R1(1)=$G(^(1))
  1. I $P(R1(0),U,14)'=SRC S RMHCOLD=""
  1. S RMHCPC=$P(R1(1),U,4)
  1. W !,"OLD CPT MODIFER: ",$P(R1(1),U,6)
  1. ;if HCPCS was changed, Modifier must be changed
  1. I RMHCOLD'=RMHCPC D
  1. .S RDA=RMHCPC_"^"_$P(R1(0),U,4)_"^"_$P(R1(0),U,14)_"^"_660
  1. .D CPT^RMPRCPTU(RDA) S $P(^RMPR(660,RMPRDA,1),U,6)=RMCPT
  1. .W !,"NEW CPT MODIFIER: ",RMCPT
  1. ;if HCPCS the same, ask user if want to edit modifier.
  1. E D
  1. .S DIR(0)="Y",DIR("B")="N",DIR("A")="Would you like to edit the CPT Modifier "
  1. .D ^DIR Q:$D(DUOUT)!$D(DTOUT)
  1. .I (Y>0) D
  1. ..S RDA=RMHCPC_"^"_$P(R1(0),U,4)_"^"_$P(R1(0),U,14)_"^"_660
  1. ..D CPT^RMPRCPTU(RDA) S $P(^RMPR(660,RMPRDA,1),U,6)=RMCPT
  1. ..K DIR
  1. ..W:RMCPT=$P(R1(1),U,6) !!,"***Based on the information given above, CPT modifier string has not changed!!!",!
  1. ..W:RMCPT'=$P(R1(1),U,6) !,"NEW CPT MODIFIER: ",RMCPT
  1. S DR="9.2;9;21;38.7;16;28" D ^DIE ;RMPR*3.0*180
  1. I RMTOTCOS'=$P(^RMPR(660,DA,0),U,16) S DR="35////^S X=DUZ;36////^S X=DT" D ^DIE
  1. I $D(DTOUT)!('$G(Y))!($D(DUOUT)) D CHK
  1. ; update 664 for Lot Number , Model, Serial Number and Contract # Changes
  1. D UPD664
  1. QED2 ;
  1. Q:$D(RMPREDT)
  1. L -^RMPR(660,RMPRDA,0)
  1. K DIR W ! S DIR(0)="Y",DIR("A")="Would You like to Edit another Entry (Y/N) " D ^DIR
  1. G:'$D(DTOUT)&(Y>0) RMPRE29
  1. EXIT ;
  1. N RMPR,RMPRSITE D KILL^XUSCLEAN
  1. K DIC,DIE,DIR,%,X,Y
  1. Q
  1. SETED2 ;set 660
  1. S ^RMPR(660,DA,0)=R1(0),^RMPR(660,DA,1)=R1(1),^RMPR(660,DA,"AM")=R1("AM")
  1. S DIK="^RMPR(660,",DA=RMPRDA D IX1^DIK K DIC
  1. D CHK
  1. Q
  1. ;
  1. QUICK ;quick edit for HCPCS and type
  1. K RMCPT
  1. W ! S DIC="^RMPR(660,",DIC(0)="AEMNQZ",DIC("A")="Select NUMBER, or Patient: "
  1. S DIC("W")="D EN^RMPRD1"
  1. S DIC("S")="I $P(^(0),U,6)!($P(^(0),U,26)'="""")" W !
  1. D ^DIC G:+Y'>0 EXIT L +^RMPR(660,+Y,0):1 I $T=0 W !,?5,$C(7),"Someone else is Editing this entry!" G EXIT
  1. ;add source
  1. S (RMPRDA,DA)=+Y,DIE=DIC,DR="2;4.5"
  1. S R1(0)=$G(^RMPR(660,DA,0)),R1(1)=$G(^RMPR(660,DA,1))
  1. S RMTYPE=$P(R1(0),U,4),RMSOUR=$P(R1(0),U,14)
  1. S RMHCOLD=$P(R1(1),U,4)
  1. D ^DIE G:$D(DUOUT)!$D(DTOUT)!$D(DIROUT)!$D(Y) SET
  1. S RMHCNEW=$P($G(^RMPR(660,DA,1)),U,4)
  1. S RMTYPE=$P($G(^RMPR(660,DA,0)),U,4)
  1. S RDA=RMHCNEW_"^"_RMTYPE_"^"_RMSOUR_"^"_660
  1. W !,"OLD CPT MODIFER: ",$P(R1(1),U,6)
  1. I RMHCOLD'=RMHCNEW D
  1. .D CPT^RMPRCPTU(RDA)
  1. .W !,"NEW CPT MODIFIER: ",RMCPT
  1. .S $P(^RMPR(660,DA,1),U,6)=RMCPT
  1. I RMHCOLD=RMHCNEW D
  1. .W ! S DIR("B")="N",DIR(0)="Y",DIR("A")="Would You like to Edit CPT MODIFIER " D ^DIR
  1. .I $D(DTOUT)!('$G(Y)) K DIR Q
  1. .D CPT^RMPRCPTU(RDA)
  1. .W:RMCPT=$P(R1(1),U,6) !!,"***Based on the information given above, CPT modifier string has not changed!!!",!
  1. .W:RMCPT'=$P(R1(1),U,6) !,"NEW CPT MODIFIER: ",RMCPT
  1. .S $P(^RMPR(660,DA,1),U,6)=RMCPT
  1. SET K DIR D CHK
  1. W ! S DIR(0)="Y",DIR("A")="Would You like to Edit another Entry (Y/N)" D ^DIR
  1. G:'$D(DTOUT)&(Y>0) QUICK^RMPRE29
  1. L -^RMPR(660,RMPRDA,0)
  1. D KILL^XUSCLEAN Q
  1. ;
  1. CHK ;check for transaction changes
  1. S RMTYPE=$P($G(^RMPR(660,RMPRDA,0)),U,4)
  1. S RMHCPC=$P($G(^RMPR(660,RMPRDA,1)),U,4) Q:'$G(RMHCPC)
  1. S RMCPT1=$P($G(^RMPR(661.1,RMHCPC,4)),U,1)
  1. S RMCPT=$P($G(^RMPR(660,RMPRDA,1)),U,6)
  1. I ((RMTYPE="R")!(RMTYPE="X")),(RMCPT'["RP"),($G(^RMPR(661.1,RMHCPC,4))["RP") D ADDRP
  1. I ((RMTYPE="I")!(RMTYPE="S")),(RMCPT["RP") D DELRP
  1. I (RMSOUR="C"),(RMCPT["RR") D DELNU
  1. I (RMSOUR="C"),(RMCPT'["RR"),(RMCPT1["NU"),(RMCPT'["N") D ADDNU
  1. K RMHCPC,RMCI,RMC,RMCLEN,RMLPIECE,RMF,RMFPIECE,RMTYPE,RMPRA,R4DA Q
  1. ;return to EDIT option
  1. DELRP ;logic for deleting 'RP' modifier with transaction change.
  1. F RMCI=1:1:8 S RMC=$P(RMCPT,",",RMCI) I RMC="RP" S $P(RMCPT,",",RMCI)="" D
  1. .S RMF=$F(RMCPT,",,"),RMFPIECE=$E(RMCPT,1,RMF-2)
  1. .S RMLPIECE=$E(RMCPT,RMF,32),RMCPT=RMFPIECE_RMLPIECE,RMCLEN=$L(RMCPT)
  1. .I $E(RMCPT,1)="," S RMCPT=$E(RMCPT,2,RMCLEN)
  1. .I $E(RMCPT,RMCLEN)="," S RMCPT=$E(RMCPT,1,RMCLEN-1)
  1. .S $P(^RMPR(660,RMPRDA,1),U,6)=RMCPT
  1. Q
  1. DELNU ;logic for deleting 'NU' modifier.
  1. F RMCI=1:1:8 S RMC=$P(RMCPT,",",RMCI) I RMC="NU" S $P(RMCPT,",",RMCI)="" D
  1. .S RMF=$F(RMCPT,",,"),RMFPIECE=$E(RMCPT,1,RMF-2)
  1. .S RMLPIECE=$E(RMCPT,RMF,32),RMCPT=RMFPIECE_RMLPIECE,RMCLEN=$L(RMCPT)
  1. .I $E(RMCPT,1)="," S RMCPT=$E(RMCPT,2,RMCLEN)
  1. .I $E(RMCPT,RMCLEN)="," S RMCPT=$E(RMCPT,1,RMCLEN-1)
  1. .S $P(^RMPR(660,RMPRDA,1),U,6)=RMCPT
  1. Q
  1. ;
  1. ADDRP ;logic for adding 'RP' modifier with transaction change.
  1. S RMCPT=RMCPT_",RP" S $P(^RMPR(660,RMPRDA,1),U,6)=RMCPT
  1. Q
  1. ADDNU ;logic for adding 'NU' modifier.
  1. S RMCPT=RMCPT_",NU" S $P(^RMPR(660,RMPRDA,1),U,6)=RMCPT
  1. Q
  1. UPD664 ; update file 664 for Lot Number, Model, Serial Number, and Contract # Changes
  1. ; -- get the changes from 660
  1. N RMFDA,RMFDA1,RMORD,RMSSFI,RMN,RMI,RMNS,RMFERR
  1. F RMI=9,9.2,21,38.7 S RMFDA(RMI)=$$GET1^DIQ(660,DA,RMI)
  1. ; -- find the 664 IEN from the order number
  1. S RMORD=$$GET1^DIQ(660,DA,23)
  1. I RMORD="" Q
  1. S RMSSFI=$O(^RMPR(664,"G",RMORD,""))
  1. I RMSSFI="" Q
  1. ; -- scan 664.02 for DA in piece 13 - RMNS will be the subscript of interest
  1. S RMNS=0
  1. F S RMNS=$O(^RMPR(664,RMSSFI,1,RMNS)) Q:+RMNS=0 Q:$P(^RMPR(664,RMSSFI,1,RMNS,0),U,13)=DA
  1. ; --save the fields into 664
  1. S RMN=""
  1. F RMI=15,15.4,15.6,13 S RMN=$O(RMFDA(RMN)) Q:RMN="" D
  1. .S RMFDA1(664.02,RMNS_","_RMSSFI_",",RMI)=RMFDA(RMN)
  1. D UPDATE^DIE(,"RMFDA1",,"RMFERR")
  1. Q
  1. ;
  1. ;END