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

APSDALVN.m

Go to the documentation of this file.
APSDALVN ;IHS/DSD/ENM/JCM ; CREATE PCC NEW RX LINKAGE ; [ 05/14/1998   4:04 PM ]
 ;;V6.0;IHS PHARMACY MODIFICATIONS;**1**;09/03/97
 ;;V5.06;APSP;MAY 07, 1990
 ; NOTE: CALLED FROM APSDALV1
 ;
 S %=APSRX0
 D ^APSPCCP
 ;S APCDALVR("APCDDATE")=$P(%,U,13)
VISIT I '$D(APCDALVR("APCDVSIT")) D GVISIT G:'$D(APCDALVR("APCDVSIT")) EXIT
VMED K APCDALVR("APCDADFN") D GVMED G:'$D(APCDALVR("APCDADFN")) EXIT
RX ;
 I $D(^PSRX(APSRX)),APCDALVR("APCDADFN") NEW DIE,DR,DA S DIE="^PSRX(",DR="9999999.11////"_APCDALVR("APCDADFN"),DA=APSRX D ^DIE K DA,DIE,DR ;IHS/OHPRD/JCM 6/11/90
EXIT K %
 Q
 ;
GVISIT ;
 ;W !,"Creating a visit to which prescriptions will link .. "
 S APCDALVR("APCDAUTO")="",APCDALVR("APCDANE")=""
 S AUPNTALK=""
 S:$D(^APSPCCTM) (^APSPCCTM,APSPCCTM)=^APSPCCTM+1,^APSPCCTM(APSPCCTM,1)=$H_"^V"
 D ^APCDALV
 I $D(APSPCCTM) S ^APSPCCTM(APSPCCTM,2)=$H K APSPCCTM
 K APCDALVR("APCDAUTO"),APCDALVR("APCDANE"),AUPNTALK
 G:$D(APCDALVR("APCDAFLG")) @("V"_APCDALVR("APCDAFLG"))
 Q
 ;
GVMED ;
 S %=APSRX0
 S APCDALVR("APCDTRX")="`"_$P(%,U,6)
 S X=$P(%,U,10),APCDALVR("APCDTSIG")=$S($L(X)<33:X,1:$E(X,1,31)_"~")
 S APCDALVR("APCDTQTY")=+$P(%,U,7)\1
 S APCDALVR("APCDTDAY")=$P(%,U,8)
 S APCDALVR("APCDTDIS")=""
 ;
 S APCDALVR("APCDATMP")="[APCDALVR 9000010.14 (ADD)]"
 K APCDALVR("APCDAFLG")
 S:$D(^APSPCCTM) (^APSPCCTM,APSPCCTM)=^APSPCCTM+1,^APSPCCTM(APSPCCTM,1)=$H_"^N"
 D ^APCDALVR
 I $D(APSPCCTM) S ^APSPCCTM(APSPCCTM,2)=$H K APSPCCTM
 G:$D(APCDALVR("APCDAFLG")) @APCDALVR("APCDAFLG")
 Q
 ;
V2 S APSERROR="inability to create visit",APSBN="V" G LBULL
V3 S APSERROR="invalid visit parameters (date, location, etc.)",APSBN="V" G LBULL
 ;
1 S APSERROR="incorrect template specification",APSBN="VMED" G LBULL
2 S APSERROR="invalid values being passed to V MED",APSBN="VMED" G LBULL
 ;
LBULL ; SEND BULLETIN - LINK FAILURE
 K XMB
 S XMB(1)=+APSRX0
 S APSPAT=$P(APSRX0,U,2)
 S XMB(2)=$P(^DPT(APSPAT,0),U,1)_" (DFN "_APSPAT_")"
 S XMB(3)="established"
 S Y=DT X ^DD("DD")
 S XMB(4)=Y
 S XMB(5)=APSERROR
 S XMB="APSP LINK FAIL "_APSBN
 S APSDUZ=DUZ,DUZ=.5 D ^XMB S DUZ=APSDUZ K XMB,APSDUZ,APSERROR,APSBN,APSPAT
 Q