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

APSDALVR.m

Go to the documentation of this file.
APSDALVR ;IHS/DSD/ENM/JCM ; CREATE PCC REFILL 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
 ; IHS/OHPRD/JCM 6/16/89 Changed GVMED+10 by adding a \1
 ;
 S APSRX0=^PSRX(APSRX,0)
 S APSRCT0=^PSRX(APSRX,1,APSRCT,0)
 S %=APSRCT0
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,1,APSRCT)),APCDALVR("APCDADFN") N DR,DA,DIE S DIE="^PSRX(APSRX,1,",DA(1)=APSRX,DA=APSRCT,DR="9999999.11////"_APCDALVR("APCDADFN") D ^DIE K DIE,DA,DR ;IHS/OHPRD/JCM 6/11/90
EXIT K %,APSRCT0
 Q
 ;
GVISIT ;
 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"_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)
 S APCDALVR("APCDTDAY")=$P(%,U,8)
 S APCDALVR("APCDTDIS")=""
 ;
 S %=APSRCT0
 S APCDALVR("APCDTDAY")=(APCDALVR("APCDTDAY")*($P(%,U,4)/APCDALVR("APCDTQTY")))+.5\1
 S APCDALVR("APCDTQTY")=+$P(%,U,4)\1 ;IHS/OHPRD/JCM 6/16/89
 ;
 S APCDALVR("APCDATMP")="[APCDALVR 9000010.14 (ADD)]"
 K APCDALVR("APCDAFLG")
 S:$D(^APSPCCTM) (^APSPCCTM,APSPCCTM)=^APSPCCTM+1,^APSPCCTM(APSPCCTM,1)=$H_"^R"
 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)="refilled"
 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