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

APSPVST1.m

Go to the documentation of this file.
APSPVST1 ; IHS/DSD/ENM - CREATE PCC NEW RX LINKAGE ;  [ 09/03/97   1:30 PM ]
 ;;6.0;IHS PHARMACY MODIFICATIONS;;09/03/97
 ; Only called from APSPVST to create linkage in real time not
 ; background.
 ;
START S APSPVST1=APSPVST("RX0"),(APSPVST1("VMDFN"),APSPVST1("VDFN"))=""
VISIT I '$D(APCDALVR("APCDVSIT")) D GVISIT G:'$D(APCDALVR("APCDVSIT")) EXIT S APSPVST1("VDFN")=APCDALVR("APCDVSIT")
VMED K APCDALVR("APCDADFN") D GVMED G:'$D(APCDALVR("APCDADFN")) EXIT S APSPVST1("VMDFN")=APCDALVR("APCDADFN")
RX ;
 I 'APSPVST("RFN"),$D(^PSRX(APSPVST("IRXN"))) NEW DIE,DR,DA S DIE="^PSRX(",DR="9999999.11////"_APCDALVR("APCDADFN"),DA=APSPVST("IRXN") D ^DIE K DA,DIE,DR ;IHS/OHPRD/JCM 6/11/90
 I APSPVST("RFN"),$D(^PSRX(APSPVST("IRXN"),1,APSPVST("RFN"))) N DR,DA,DIE S DIE="^PSRX(APSPVST(""IRXN""),1,",DA(1)=APSPVST("IRXN"),DA=APSPVST("RFN"),DR="9999999.11////"_APCDALVR("APCDADFN") D ^DIE K DIE,DA,DR ;IHS/OHPRD/JCM 6/11/90
EXIT ;
 K APSPVST1,X,Y
 Q
 ;
GVISIT ;
 ;W !,"Creating a visit to which prescriptions will link .. "
 S APCDALVR("APCDAUTO")="",APCDALVR("APCDANE")=""
 S AUPNTALK=""
 D ^APCDALV
 K APCDALVR("APCDAUTO"),APCDALVR("APCDANE"),AUPNTALK
 G:$D(APCDALVR("APCDAFLG")) @("V"_APCDALVR("APCDAFLG"))
 Q
 ;
GVMED ;
 S APCDALVR("APCDTRX")="`"_$P(APSPVST1,U,6)
 S X=$P(APSPVST1,U,10),APCDALVR("APCDTSIG")=$S($L(X)<33:X,1:$E(X,1,31)_"~")
 S APCDALVR("APCDTQTY")=+$P(APSPVST1,U,7)\1
 S APCDALVR("APCDTDAY")=$P(APSPVST1,U,8)
 S APCDALVR("APCDTDIS")=""
 ;
 S APCDALVR("APCDATMP")="[APCDALVR 9000010.14 (ADD)]"
 K APCDALVR("APCDAFLG")
 D ^APCDALVR
 G:$D(APCDALVR("APCDAFLG")) @APCDALVR("APCDAFLG")
 Q
 ;
V2 S APSPVST1("ERROR")="inability to create visit",APSPVST1("BN")="V" G LBULL
V3 S APSPVST1("ERROR")="invalid visit parameters (date, location, etc.)",APSPVST1("BN")="V" G LBULL
 ;
1 S APSPVST1("ERROR")="incorrect template specification",APSPVST1("BN")="VMED" G LBULL
2 S APSPVST1("ERROR")="invalid values being passed to V MED",APSPVST1("BN")="VMED" G LBULL
 ;
LBULL ; SEND BULLETIN - LINK FAILURE
 W !,"ERROR HAS OCCURED RX DFN= ",+APSPVST1
 K XMB
 S XMB(1)=+APSPVST1
 S XMB(2)=$P(^DPT(APSPVST("PSDFN"),0),U,1)_" (DFN "_APSPVST("PSDFN")_")"
 S XMB(3)=$S(APSPVST("RFN")=0:"established",1:"refilled")
 S Y=DT X ^DD("DD")
 S XMB(4)=Y
 S XMB(5)=APSPVST1("ERROR")
 S XMB="APSP LINK FAIL "_APSPVST1("BN")
 S APSPVST("DUZ")=DUZ,DUZ=.5 D ^XMB S DUZ=APSPVST("DUZ") K XMB,APSPVST("DUZ"),APSPVST1("ERROR"),APSPVST1("BN")
 Q