APSPLIS ; IHS/DSD/ENM - OUTPATIENT PHARMACY INVENTORY LIST ; [ 02/26/2003 9:48 AM ]
;;6.0;IHS PHARMACY MODIFICATIONS;**4**;09/03/97
EN ;EP
K ^TMP("APSPI",$J)
W @IOF,!!,"Outpatient Pharmacy Inventory Listing!",!!
DIV ;SELECT DIVISION
;S DIR(0)="Y",DIR("A")="Would you like all divisions",DIR("B")="YES",DIR("?")="Enter 'Yes' or 'No'" D ^DIR K DIR Q:$D(DTOUT)
;I X="YES" S APSPDAN="A" G DRU
;S DIR(0)="PO^59:EMZ",DIR("A")="Select Division",DIR("?")="Enter the Division Name or Number "
;D ^DIR G:$D(DTOUT)!$D(DUOUT) ZAP K DIR
S APSPDAN=PSOSITE
DRU S DIR(0)="S^1:All Drugs;2:Controlled Drugs Only;",DIR("A")="Select: (1) or (2)" D ^DIR K DIR
G:$D(DUOUT)!$D(DIRUT) ZAP S APSPANS=Y,APSPTYPE=Y(0)
DEV S %ZIS="QM",%ZIS("A")="Select Printer: "
D ^%ZIS K %ZIS
I POP G ZAP
I $D(IO("Q")),IO=0 W !,"QUEUEING TO YOUR SCREEN IS NOT ALLOW! " K IO("Q") G DEV
I IO=IO(0)!('$D(IO("Q"))) G AUS
S ZTRTN="AUS^APSPLIS"
S ZTDESC="Drug Inventory List"
F X="ZTDESC","APSPANS","APSPTYPE","APSPDAN" S ZTSAVE(X)=""
D ^%ZTLOAD
G ZAP
AUS S APSPA=0,APSPA1=0,APSP("PAGE")=0
U IO
;I +APSPDAN S APSPA1=APSPDAN G LOOP
;I APSPDAN="A" S APSPA1=0 G LOOP2
;Q
LOOP ;GET DRUGS FOR ONE DIVISION
F S APSPA=$O(^PSDRUG(APSPA)) Q:'APSPA S APSPSH=$P($G(^PSDRUG(APSPA,0)),U,3),APSPCI=$P($G(^PSDRUG(APSPA,660.1)),U) D LIST
CON S APSPDN=""
D SHOW
D ^%ZISC ;IHS/ITSC/ENM 02/26/03
D ZAP
Q
HDR ;
S APSPDIV=$P($G(^PS(59,APSPDAN,0)),U)
D NOW^%DTC S Y=X X ^DD("DD") S APSP("PAGE")=APSP("PAGE")+1
W @IOF
W !,"Outpatient Pharmacy Inventory Listing",?50,"Page ",APSP("PAGE"),?65,Y,!,"For """,APSPTYPE,"""",!,"Division: ",APSPDIV,!
W ?40,"Dispense",?65,"Current",!,"Drug Name",?40,"Unit",?65,"Inventory",!,"---------",?40,"---------",?65,"---------",!
Q
LIST ;
Q:$D(^PSDRUG(APSPA,"I"))
S APSPZ=2
I APSPANS=2&("2345"[+APSPSH) D SAV Q
I APSPANS=1 D SAV
Q
SHOW ;
S APSPDN=0,APZ=0
;F S APSPDAN=$O(^TMP("APSPLIS",$J,APSPDAN)) Q:'APSPDAN D HDR,SHOW1
D HDR,SHOW1
Q
SHOW1 F S APZ=$O(^TMP("APSPLIS",$J,APZ)) Q:'APZ F S APSPDN=$O(^TMP("APSPLIS",$J,APZ,APSPDN)) Q:APSPDN="" D LIST1 Q:$D(DUOUT)!($D(DTOUT))
Q
LIST1 ;
S APSPDU=$P(^TMP("APSPLIS",$J,APZ,APSPDN),U),APSPCI=$P(^TMP("APSPLIS",$J,APZ,APSPDN),U,2)
I $Y+4>IOSL,IOST["C" D FZZ Q:$D(DUOUT)!($D(DTOUT))
I $Y+4>IOSL D HDR
W !,APSPDN,?40,APSPDU,?65,$J($FN(APSPCI,","),8)
Q
SAV ;
I "2"[+APSPSH S APSPZ=1
S APSPDN=$P(^PSDRUG(APSPA,0),U),APSPDU=$P($G(^PSDRUG(APSPA,660)),U,8)
S ^TMP("APSPLIS",$J,APSPZ,APSPDN)=APSPDU_"^"_APSPCI
Q
FZZ ;IHS/DSD/ENM 10/95
K DTOUT,DUOUT,DIR S DIR("?")="Enter '^' to Halt or Press Return to Continue",DIR(0)="FO",DIR("A")="Press 'RETURN' to Continue or '^' to 'HALT'" D ^DIR
Q
ZAP K APSPANS,APSPA,APSPCI,APSPDN,APSPDU,APSP("PAGE"),APSPTYPE,^TMP("APSPLIS",$J),APSPDL,APSPBS,APSPDAN,APSP("IOF"),APSPDIV,APSPSH,APSPA1,APSPZ,APZ
Q
APSPLIS ; IHS/DSD/ENM - OUTPATIENT PHARMACY INVENTORY LIST ; [ 02/26/2003 9:48 AM ]
+1 ;;6.0;IHS PHARMACY MODIFICATIONS;**4**;09/03/97
EN ;EP
+1 KILL ^TMP("APSPI",$JOB)
+2 WRITE @IOF,!!,"Outpatient Pharmacy Inventory Listing!",!!
DIV ;SELECT DIVISION
+1 ;S DIR(0)="Y",DIR("A")="Would you like all divisions",DIR("B")="YES",DIR("?")="Enter 'Yes' or 'No'" D ^DIR K DIR Q:$D(DTOUT)
+2 ;I X="YES" S APSPDAN="A" G DRU
+3 ;S DIR(0)="PO^59:EMZ",DIR("A")="Select Division",DIR("?")="Enter the Division Name or Number "
+4 ;D ^DIR G:$D(DTOUT)!$D(DUOUT) ZAP K DIR
+5 SET APSPDAN=PSOSITE
DRU SET DIR(0)="S^1:All Drugs;2:Controlled Drugs Only;"
SET DIR("A")="Select: (1) or (2)"
DO ^DIR
KILL DIR
+1 IF $DATA(DUOUT)!$DATA(DIRUT)
GOTO ZAP
SET APSPANS=Y
SET APSPTYPE=Y(0)
DEV SET %ZIS="QM"
SET %ZIS("A")="Select Printer: "
+1 DO ^%ZIS
KILL %ZIS
+2 IF POP
GOTO ZAP
+3 IF $DATA(IO("Q"))
IF IO=0
WRITE !,"QUEUEING TO YOUR SCREEN IS NOT ALLOW! "
KILL IO("Q")
GOTO DEV
+4 IF IO=IO(0)!('$DATA(IO("Q")))
GOTO AUS
+5 SET ZTRTN="AUS^APSPLIS"
+6 SET ZTDESC="Drug Inventory List"
+7 FOR X="ZTDESC","APSPANS","APSPTYPE","APSPDAN"
SET ZTSAVE(X)=""
+8 DO ^%ZTLOAD
+9 GOTO ZAP
AUS SET APSPA=0
SET APSPA1=0
SET APSP("PAGE")=0
+1 USE IO
+2 ;I +APSPDAN S APSPA1=APSPDAN G LOOP
+3 ;I APSPDAN="A" S APSPA1=0 G LOOP2
+4 ;Q
LOOP ;GET DRUGS FOR ONE DIVISION
+1 FOR
SET APSPA=$ORDER(^PSDRUG(APSPA))
IF 'APSPA
QUIT
SET APSPSH=$PIECE($GET(^PSDRUG(APSPA,0)),U,3)
SET APSPCI=$PIECE($GET(^PSDRUG(APSPA,660.1)),U)
DO LIST
CON SET APSPDN=""
+1 DO SHOW
+2 ;IHS/ITSC/ENM 02/26/03
DO ^%ZISC
+3 DO ZAP
+4 QUIT
HDR ;
+1 SET APSPDIV=$PIECE($GET(^PS(59,APSPDAN,0)),U)
+2 DO NOW^%DTC
SET Y=X
XECUTE ^DD("DD")
SET APSP("PAGE")=APSP("PAGE")+1
+3 WRITE @IOF
+4 WRITE !,"Outpatient Pharmacy Inventory Listing",?50,"Page ",APSP("PAGE"),?65,Y,!,"For """,APSPTYPE,"""",!,"Division: ",APSPDIV,!
+5 WRITE ?40,"Dispense",?65,"Current",!,"Drug Name",?40,"Unit",?65,"Inventory",!,"---------",?40,"---------",?65,"---------",!
+6 QUIT
LIST ;
+1 IF $DATA(^PSDRUG(APSPA,"I"))
QUIT
+2 SET APSPZ=2
+3 IF APSPANS=2&("2345"[+APSPSH)
DO SAV
QUIT
+4 IF APSPANS=1
DO SAV
+5 QUIT
SHOW ;
+1 SET APSPDN=0
SET APZ=0
+2 ;F S APSPDAN=$O(^TMP("APSPLIS",$J,APSPDAN)) Q:'APSPDAN D HDR,SHOW1
+3 DO HDR
DO SHOW1
+4 QUIT
SHOW1 FOR
SET APZ=$ORDER(^TMP("APSPLIS",$JOB,APZ))
IF 'APZ
QUIT
FOR
SET APSPDN=$ORDER(^TMP("APSPLIS",$JOB,APZ,APSPDN))
IF APSPDN=""
QUIT
DO LIST1
IF $DATA(DUOUT)!($DATA(DTOUT))
QUIT
+1 QUIT
LIST1 ;
+1 SET APSPDU=$PIECE(^TMP("APSPLIS",$JOB,APZ,APSPDN),U)
SET APSPCI=$PIECE(^TMP("APSPLIS",$JOB,APZ,APSPDN),U,2)
+2 IF $Y+4>IOSL
IF IOST["C"
DO FZZ
IF $DATA(DUOUT)!($DATA(DTOUT))
QUIT
+3 IF $Y+4>IOSL
DO HDR
+4 WRITE !,APSPDN,?40,APSPDU,?65,$JUSTIFY($FNUMBER(APSPCI,","),8)
+5 QUIT
SAV ;
+1 IF "2"[+APSPSH
SET APSPZ=1
+2 SET APSPDN=$PIECE(^PSDRUG(APSPA,0),U)
SET APSPDU=$PIECE($GET(^PSDRUG(APSPA,660)),U,8)
+3 SET ^TMP("APSPLIS",$JOB,APSPZ,APSPDN)=APSPDU_"^"_APSPCI
+4 QUIT
FZZ ;IHS/DSD/ENM 10/95
+1 KILL DTOUT,DUOUT,DIR
SET DIR("?")="Enter '^' to Halt or Press Return to Continue"
SET DIR(0)="FO"
SET DIR("A")="Press 'RETURN' to Continue or '^' to 'HALT'"
DO ^DIR
+2 QUIT
ZAP KILL APSPANS,APSPA,APSPCI,APSPDN,APSPDU,APSP("PAGE"),APSPTYPE,^TMP("APSPLIS",$JOB),APSPDL,APSPBS,APSPDAN,APSP("IOF"),APSPDIV,APSPSH,APSPA1,APSPZ,APZ
+1 QUIT