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

APSPVST.m

Go to the documentation of this file.
APSPVST ; IHS/DSD/ENM - CHECK PRESCRIPTION FILE FOR VMED LINKAGE ;  [ 09/03/97   1:30 PM ]
 ;;6.0;IHS PHARMACY MODIFICATIONS;;09/03/97
 ;
 ;------------------------------------------------------------------
START ;
 D ^XBKVAR
 S APSPVST("BD")=0
 S APSPVST("BD")=$S($D(^TMP("APSPVST","LAST DATE")):^TMP("APSPVST","LAST DATE"),1:$O(^AUPNVSIT("B",0)))
 G:'APSPVST("BD") END
 D ASK
 G:$D(APSPVST("QFLG")) END
 D DATE
END D EOJ
 Q
 ;-------------------------------------------------------------------
EN ;
 D ^XBKVAR
 D ASK
 G:$D(APSPVST("QFLG")) ENX
 D CHECK D:$D(APSPVST("DIFFLG")) FIX
ENX D EOJ
 Q
 ;
ASK ;
 S DIR(0)="S^I:IHS;C:CONTRACT;T:TRIBAL;O:OTHER;6:638;V:VA",DIR("A")="DEFAULT TYPE OF VISIT TO CREATE"
 D ^DIR
 K DIR I $D(DIRUT) S APSPVST("QFLG")=1 K DIRUT,DTOUT,DUOUT,BD,ED G ASKX
 S APSPVST("APCDTYPE")=Y K X,Y
ASKX ;
 Q
DATE ;
 W !!!,"No. of RX's Checked : ",?40,"No. of V Med's Created : ",!
 S (APSPVST("COUNT"),APSPVST("DLCOUNT"))=0
 F APSPVST("DATE")=(APSPVST("BD")-1):0 S APSPVST("DATE")=$O(^PSRX("AD",APSPVST("DATE"))) Q:'APSPVST("DATE")  D RX
 W APSPVST("COUNT"),?40,APSPVST("DLCOUNT"),$C(13)
 W !!,"All done ..."
 Q
RX ;
 ;APSPVST("IRXN") IS THE SUBSCRIPT PRESCRIPTION NUMBER
 F APSPVST("IRXN")=0:0 S APSPVST("IRXN")=$O(^PSRX("AD",APSPVST("DATE"),APSPVST("IRXN"))) Q:APSPVST("IRXN")=""  S APSPVST("RFN")=$O(^(APSPVST("IRXN"),"")) D CHECK D:$D(APSPVST("DIFFLG")) FIX
 Q
CHECK ;
 S APSPVST("COUNT")=APSPVST("COUNT")+1
 W APSPVST("COUNT"),?40,APSPVST("DLCOUNT"),$C(13)
 K APSPVST("PSDFN"),APSPVST("VMDFN"),APSPVST("VDFN"),APSPVST("DIFFLG")
 I $D(^PSRX(APSPVST("IRXN"),0)),$P(^(0),U,2) S APSPVST("PSDFN")=$P(^(0),U,2)
 Q:'$D(APSPVST("PSDFN"))
 I APSPVST("RFN")>0,$S('$D(^PSRX(APSPVST("IRXN"),1,APSPVST("RFN"),999999911)):1,^(999999911)="":1,1:0) S APSPVST("DIFFLG")=1
 I APSPVST("RFN")=0,$S('$D(^PSRX(APSPVST("IRXN"),999999911)):1,^(999999911)="":1,1:0) S APSPVST("DIFFLG")=1
 Q
FIX ;
 D INIT ; Initializes variables needed to create V Med and Visit Entry
 D ^APSPVST1 K APCDALVR ;Creates V Med entry and possibly Visit
 S APSPVST("DLCOUNT")=APSPVST("DLCOUNT")+1
 Q
INIT ;
 K APCDALVR
 S APSPVST("RX0")=^PSRX(APSPVST("IRXN"),0)
 S APCDALVR("APCDPAT")=APSPVST("PSDFN")
 S APCDALVR("APCDDATE")=$S(APSPVST("RFN")=0:$P(APSPVST("RX0"),U,13),1:$P(^PSRX(APSPVST("IRXN"),1,APSPVST("RFN"),0),U,1))
 S APCDALVR("APCDLOC")=DUZ(2)
 S APCDALVR("APCDTYPE")=APSPVST("APCDTYPE")
 S APCDALVR("APCDCAT")=$S($P(APSPVST("RX0"),U,3)=1:"A",1:"I")
 Q 
EOJ ;
 K APSPVST
 Q