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

APSQDI1.m

Go to the documentation of this file.
APSQDI1 ;IHS/ASDS/ENM/POC - LOOK UP CONTINUED FM APSQDI[ 05/25/2001  4:05 PM ]
 ;;6.0;IHS PHARMACY MODIFICATIONS;**3**;01/10/2001
EN1 ;
 K APSQARR
 S APSQCNT=0,APSQLKUP=""
 ;S APSQSEQ=0 F  S APSQSEQ=$O(^APSQFA("S",APSQSEQ)) Q:APSQSEQ=""   D
 S:'$D(PSOSITE) PSOSITE=$O(^PS(59,"C",DUZ(2),"")) ;IF PSOSITE NOT SET MULTIPLE DIVISIONS IHS/OKCAO/POC 1/10/2001
 S:'$O(^APSQFA("SD",PSOSITE,"")) VALMQUIT=1 ;QUIT IF NO ENTRIES IHS/OKCAO/POC 5/12/2001
 S APSQSEQ=0 F  S APSQSEQ=$O(^APSQFA("SD",PSOSITE,APSQSEQ)) Q:APSQSEQ=""   D  ;USE THE SD XREF MULTIPLE DIVISIONS 1/10/2001 IHS/OKCAO/POC
 .S APSQLKUP=$$SETSTR^VALM1($J(APSQSEQ,2),APSQLKUP,3,3)
 .;S APSQIEN=$O(^APSQFA("S",APSQSEQ,""))
 .S APSQIEN=$O(^APSQFA("SD",PSOSITE,APSQSEQ,"")) ;USE THE SD XREF MULTIPLE DIVISIONS 1/10/2001 IHS/OKCAO/POC
 .Q:'APSQIEN
 .S APSQNAME=$P(^APSQFA(APSQIEN,0),U,1)
 .S APSQLKUP=$$SETSTR^VALM1(APSQNAME,APSQLKUP,8,15)
 .;I $D(^APSQFA(APSQIEN,2))#10 S APSQSEC="EXPLODE"
 .I $O(^APSQFA(APSQIEN,2,0)) S APSQSEC="EXPLODE"
 .E  S APSQSEC=$P(^PSDRUG($P(^APSQFA(APSQIEN,0),U,2),0),U,1)
 .S APSQLKUP=$$SETSTR^VALM1(APSQSEC,APSQLKUP,25,20)
 .S APSQARR(APSQSEQ,0)=APSQLKUP
 .S APSQCNT=APSQCNT+1
 .S APSQARR("IDX",APSQCNT,APSQSEQ)=APSQIEN
 .S APSQLKUP=""
 .Q
 ;NEED TO SET VALMCNT=APSQCNT
 Q
EN2 ;LOOK UP
 K APSQARR
 S (APSQCNT,APSQLKUP)="",(APSQLAST,APSQKILL)=0
 ;S APSQSEQ=0 F  S APSQSEQ=$O(^APSQFA("S",APSQSEQ)) Q:APSQSEQ=""   D  
 S:'$D(PSOSITE) PSOSITE=$O(^PS(59,"C",DUZ(2),"")) ;IF NOT SET MULTIPLE DIVISIONS IHS/OKCAO/POC 1/10/2001
 S:'$O(^APSQFA("SD",PSOSITE,"")) VALMQUIT=1 ;QUIT IF NO ENTRIES IHS/OKCAO/POC 5/12/2001
 S APSQSEQ=0 F  S APSQSEQ=$O(^APSQFA("SD",PSOSITE,APSQSEQ)) Q:APSQSEQ=""   D  ;IHS/OKCAO/POC USE THIS NEW SD XREF TO GET ONLY DRUGS FOR THIS DIVISION MULTIPLE DIVISIONS1/10/2001
 .;ADD THE NEXT TWO LINES TO SCREEN OUT ENTRIES NOT THIS DIVISION IHS/OKCAO/POC 1/10/2001
 .;S APSQSEEN=$O(^APSQFA("SD",PSOSITE,APSQSEQ,""))
 .;Q:$P(^APSQFA(APSQSEEN,0),U,10)'=PSOSITE
 .D SUB1
 .D SWT
 .;S:'APSQKILL APSQCNT=APSQCNT+1
 .D FILE:'APSQKILL
 I APSQKILL S APSQLAST=1 D FILE ;FOR THE LAST ONE IF ODD
 ;D FILE2
 Q
SUB1 ;S APSQSEQ=APSQSEQ+1
 I $D(APSQ("GOT",APSQSEQ)) S APSQSTAR=1
 ;I 'APSQKILL S APSQLKUP=$$SETSTR^VALM1($J($S($G(APSQSTAR):"*",1:"")_APSQSEQ,2),APSQLKUP,3,3)
 I 'APSQKILL S APSQLKUP=$$SETSTR^VALM1($J($S($G(APSQSTAR):"*",1:"")_APSQSEQ,4),APSQLKUP,3,4)
 ;I APSQKILL S APSQLKUP=$$SETSTR^VALM1($J($S($G(APSQSTAR):"*",1:"")_APSQSEQ,2),APSQLKUP,40,3)
 I APSQKILL S APSQLKUP=$$SETSTR^VALM1($J($S($G(APSQSTAR):"*",1:"")_APSQSEQ,4),APSQLKUP,40,4)
 K APSQSTAR
 ;S APSQIEN=$O(^APSQFA("S",APSQSEQ,""))
 S APSQIEN=$O(^APSQFA("SD",PSOSITE,APSQSEQ,"")) ;USE THE SD XREF MULTIPLE DIVISIONS IHS/OKCAO/POC 1/10/2001
 Q:'APSQIEN
 S APSQNAME=$P(^APSQFA(APSQIEN,0),U,1)
 I 'APSQKILL S APSQLKUP=$$SETSTR^VALM1(APSQNAME,APSQLKUP,8,10)
 I APSQKILL S APSQLKUP=$$SETSTR^VALM1(APSQNAME,APSQLKUP,45,10)
 ;I $D(^APSQFA(APSQIEN,2))#10 S APSQSEC="EXPLODE"
 I $O(^APSQFA(APSQIEN,2,0)) S APSQSEC="EXPLODE"
 E  S APSQSEC=$P(^PSDRUG($P(^APSQFA(APSQIEN,0),U,2),0),U,1)
 I 'APSQKILL S APSQLKUP=$$SETSTR^VALM1(APSQSEC,APSQLKUP,20,15)
 I APSQKILL S APSQLKUP=$$SETSTR^VALM1(APSQSEC,APSQLKUP,57,15)
 Q
FILE ;
 S APSQCNT=APSQCNT+1
 ;S APSQARR(APSQSEQ,0)=APSQLKUP
 S APSQARR(APSQCNT,0)=APSQLKUP
 S APSQLKUP=""
 Q
 ;LINE BELOW FOR LAST ONE
 I APSQLAST S APSQLAST=0 S APSQARR("TMP",APSQCNT)=(APSQCNT*2-1)
 ;THIS WHOLE SERIES OF LINES TO SET IDX IS TO GET AROUND ONE COLUMN
 E  S APSQARR("TMP",APSQCNT)=(APSQCNT*2-1)_","_(APSQCNT*2)
 Q
FILE2 ;FIX IDX
 S (I,IDX)=0 F  S IDX=$O(APSQARR("TMP",IDX)) Q:IDX=""  D
 .S I=I+1
 .;VALM("BM") IS THE BOTTOM MARGIN MUST BE 6!!! OR MUST CHANGE "4" BELOW
 .S APSQBM=VALM("BM")-4 ;GOT FOUR LINES AT BEGINNING OF HEADING
 .S APSQARR("IDX",IDX,$S((I=APSQBM)&$P(APSQARR("TMP",IDX),",",2):$P(APSQARR("TMP",IDX),",",2),1:$P(APSQARR("TMP",IDX),",",1)))=""
 .I I=VALM("BM") S I=0
 ;NEED TO SET VALMCNT=APSQCNT
 Q
SWT ;SWITH APSQKILL BACK AND FORTH BETWEEN 1 AND 0
 ;APSQKILL IS USED TO SET THE FIRST AND SECOND PART OF VARIABLE APSQLKUP
 ;AND SET A APSQARR("DIR",APSQSEQ,APSQIEN)=""
 S APSQARR("DIR",APSQSEQ,APSQIEN)=""
 I APSQKILL=1 S APSQKILL=0 Q
 E  S APSQKILL=1
 Q
DEL ;DELETE ENTITIES
 ;
 D FULL^VALM1
 I '$D(APSQ("GOT")) W !,"YOU DONT HAVE ANY ENTRIES TO DELETE-BYE" D BACK Q
 S APSQBEG=$O(APSQARR("DIR","")),APSQEND=$O(APSQARR("DIR",""),-1)
 K DIR
 S DIR(0)="LO^"_APSQBEG_":"_APSQEND
 D ^DIR
 I '+Y W !,"NO SELECTIONS-BYE" Q
 S APSQY="" F  S APSQY=$O(Y(APSQY)) Q:APSQY=""  D
 .F I=1:1 S APSQGOT=$P(Y(APSQY),",",I) Q:APSQGOT=""  D
 ..S APSQGOTT=$O(APSQ("GOT",APSQGOT,""))
 ..I APSQGOTT="" W !,"NO SUCH CRITTER ",APSQGOT
 ..;E  S APSQARR("GOT",APSQGOTT)=""
 ..;SO APSQ("GOT") IS THE ARRAY YOU CHOSE
 ..;E  S APSQARR("GOT",APSQGOT,APSQGOTT)="",APSQ("GOT",APSQGOT,APSQGOTT)=""
 ..E  S APSQARR("GOT",APSQGOT,APSQGOTT)="" ;FOR LIST BUT GETS DELETED AT ENTRY POINT EN?
 ..E  K APSQ("GOT",APSQGOT,APSQGOTT)
 D LIST,HANG,WIPE,EN2,BACK
 Q
ADD ;SELECT ENTITIES
 ;D EN^VALM2(XQORNOD(0),"O") ;this list man call allows user to select an entry in list
 ;I '$D(VALMY) W !,"Nothing selected." Q
 D FULL^VALM1 ;give me full control of screen
 Q:'$D(APSQARR("DIR"))
 S APSQBEG=$O(APSQARR("DIR","")),APSQEND=$O(APSQARR("DIR",""),-1)
 K DIR
 S DIR(0)="LO^"_APSQBEG_":"_APSQEND
 D ^DIR
 I '+Y W !,"NO SELECTIONS-BYE" Q
 S APSQY="" F  S APSQY=$O(Y(APSQY)) Q:APSQY=""  D
 .F I=1:1 S APSQGOT=$P(Y(APSQY),",",I) Q:APSQGOT=""  D
 ..S APSQGOTT=$O(APSQARR("DIR",APSQGOT,""))
 ..I APSQGOTT="" W !,"NO SUCH CRITTER ",APSQGOT," SO ITEM DELETED!"
 ..;E  S APSQARR("GOT",APSQGOTT)=""
 ..;SO APSQ("GOT") IS USED TO PUT STARS IN FRONT OF SEQUENCE
 ..;APSQARR IS FOR LIST BUT GETS DELETED AT EN? ENTRY POINT
 ..E  S APSQARR("GOT",APSQGOT,APSQGOTT)="",APSQ("GOT",APSQGOT,APSQGOTT)=""
 D LIST,HANG,SET,EN2,BACK
 Q
HANG ;
 K DIR
 S DIR(0)="EO",DIR("A")="HIT RETURN TO CONTINUE..." D ^DIR K DIR
 Q
LIST ;LIST ENTRIES SELECTED
 W !,$S($D(APSQARR("GOT")):"",1:"NO ")," ENTRIES SELECTED:"
 S APSQLIST=0 F  S APSQLIST=$O(APSQARR("GOT",APSQLIST)) Q:APSQLIST=""  D
 .S APSQLIS1=$O(APSQARR("GOT",APSQLIST,""))
 .W !,$P(^APSQFA(APSQLIS1,0),U,1)
 Q
 ;
SET ;SET UP FOR NEXT PART
 S APSQLIST=0 F  S APSQLIST=$O(APSQ("GOT",APSQLIST)) Q:APSQLIST=""  D
 .S APSQLIS1=$O(APSQ("GOT",APSQLIST,""))
 .I $O(^APSQFA(APSQLIS1,2,0)) D 
 ..S APSQEXP=0 F  S APSQEXP=$O(^APSQFA(APSQLIS1,2,APSQEXP)) Q:'+APSQEXP  D  ; 
 ...S APSQEXP1=$P(^APSQFA(APSQLIS1,2,APSQEXP,0),U,1)
 ...I APSQEXP1 S DRUGPICK(APSQEXP1)=""
 ...;S APSQEXP2=$P(^APSQFA(APSQEXP1,0),U,2) ;S DRUG(APSQEXP1)=""
 ...;I APSQEXP2 S DRUG(APSQEXP2)=""
 ..K DRUGPICK(APSQLIS1)
 .I '$O(^APSQFA(APSQLIS1,2,0)) I $P(^APSQFA(APSQLIS1,0),U,2) S DRUGPICK(APSQLIS1)=""
 .;I $P(^APSQFA(APSQLIS1,0),U,2) S DRUG($P(^(0),U,2))=""
 Q
BACK ;GO BACK
 D TERM^VALM0
 S VALMBCK="R"
 ;D INIT AGAIN
 K DIR
 Q
 ;
WIPE ;DELEETE ENTRIES FROM DRUG ARRAY USING APSQARR("GOT")
 S APSQGOT=0 F  S APSQGOT=$O(APSQARR("GOT",APSQGOT)) Q:APSQGOT=""  D
 .S APSQGOT1=$O(APSQARR("GOT",APSQGOT,""))
 .I $O(^APSQFA(APSQGOT1,2,0)) D
 ..S DRUG=0 F  S DRUG=$O(^APSQFA(APSQGOT1,2,DRUG)) Q:DRUG'=+DRUG  D
 ...I DRUG S DRUG1=$P(^APSQFA(APSQGOT1,2,DRUG,0),U,1)
 ...;I DRUG1 K DRUG(DRUG1)
 ...I DRUG1 K DRUGPICK(DRUG1)
 .;I $P(^APSQFA(APSQGOT1,0),U,2) K DRUG($P(^(0),U,2))
 .I $P(^APSQFA(APSQGOT1,0),U,2) K DRUGPICK(APSQGOT1)
 Q