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

APSPRT1.m

Go to the documentation of this file.
APSPRT1 ; IHS/DSD/ENM - INITIALIZE PREPACK VARIABLES ;  [ 08/25/1999  2:59 PM ]
 ;;6.0;IHS PHARMACY MODIFICATIONS;**2**;09/03/97
START ;
 ;
 I '$D(%APSITE),$D(^APSPCTRL(PSOSITE,0)) S %APSITE=^(0) ;IHS/DSD/ENM 08/01/96
 I $P(%APSITE,U,16)'>1 W !,"You must first enter the IHS site parameters dealing with",!,"prepack label sizes and widths . Thank you" S APSPRT("QUIT")=1 G INITX
 I $P(%APSITE,U,22)'>2 W !,"You must first enter a Prepack Label Width under the IHS site parameters. Thank you" S APSPRT("QUIT")=1 G INITX
 F I=16:1:19 S APSP(I)=+$P(%APSITE,U,I)
 F I=21:1:28 S APSP(I)=+$P(%APSITE,U,I)
 S APSP(29)=$P(%APSITE,U,29)
 S APSP(31)=+$P(%APSITE,U,31)
 S APSP("LINE1")=$P(%APSITE,U,32)
 S APSP("LINE2")=$P(%APSITE,U,33)
 S %ZIS="N",%ZIS("A")="Prepack Label Printer : " D ^%ZIS
 K %ZIS
 S:POP=0 APSPRT("IO")=ION
 S:POP=1 APSPRT("QUIT")=1
 D EXPDATE ;Sets APSP("EXPDATE")=TODAY + 6 MONTHS
 S APSP("LASTP")=$S($D(^APSPP(31,"LAST")):$P(^APSPP(31,"LAST"),U,1),1:"")
 S APSP("LASTU")=$S($D(^APSPP(31,"LAST")):$P(^APSPP(31,"LAST"),U,2),1:"")
INITX ; Exit point for INIT subroutine
 Q
EXPDATE ;
 S X="T+6M" D ^%DT
 ;S APSP("EXPDATE")=$E(Y,4,5)_"/"_$E(Y,2,3)
 S APSP("EXPDATE")=$E(Y,4,5)_"/"_$E(Y,6,7)_"/"_$E(Y,2,3) ;IHS/DSD/ENM 07/14/99
 Q
EN ;EP
 ;
 S APSPGY="" F APSP=1:1:$L(APSP("SIG")," ") S X=$P(APSP("SIG")," ",APSP) S:X]"" APSPGY=APSPGY_X_" "
 S APSPS=1,APSPY=APSP(22)-2,APSPE=APSP(22)-1,APSPDR1=0
SIG1 F APSPF=APSPS:0:APSPY S APSPF=$F(APSPGY," ",APSPF) Q:'APSPF  I APSPF'>APSPY,$L(APSPGY)>(APSP(22)-3) S APSPE=APSPF
 S X=$E(APSPGY,APSPS,APSPE-2),APSPS=APSPE,APSPY=APSPS+APSP(22)-4,APSPDR1=APSPDR1+1,APSPGY(APSPDR1)=X
 G SIG1:APSPE<$L(APSPGY) S APSPGC=APSPDR1,APSPGY(APSPDR1)=APSPGY(APSPDR1)_"."
 I $L(APSP("DRUG"))+$L(APSP("QTY"))+3>APSP(22) D SIG2
 K APSP("SIG"),APSPE,APSPF,APSPS,APSPY
 Q
SIG2 ;
 I $L(APSP("QTY"))+$L(APSPGY(APSPGC))+1<APSP(22) S APSPGY(APSPGC)=APSPGY(APSPGC)_$E("           ",1,APSP(22)-$L(APSP("QTY"))-$L(APSPGY(APSPGC))-2)_APSP("QTY") S APSP("QTYFLG")=""
 I '$D(APSP("QTYFLG")) S APSPGC=APSPGC+1,APSPGY(APSPGC)=APSP("QTY") S APSP("QTYFLG")=""
 Q