VistA-WorldVistAEHR/r/OUTPATIENT_PHARMACY-PSO-APS.../PSOLLL6.m

50 lines
2.1 KiB
Mathematica

PSOLLL6 ;BHAM/BHW - LABEL TRAILER ;12/02/2002
;;7.0;OUTPATIENT PHARMACY;**120,141,135,162,161**;DEC 1997
;
I $G(PSOBLALL),$P(PPL,",",PI+1)'="" Q
S PRCOPAY=$S('$D(PSOCPN):0,1:1)
NARR ;NARRATIVES
S (PSSIXFL,PSSEVFL,LENGTH,OUT)=0,PTEXT=""
I $G(PSOIO("RNI"))]"" X PSOIO("RNI")
S XFONT=$E(PSOFONT,2,99)
I $D(^PS(59,PSOSITE,6))!($D(^PS(59,PSOSITE,7))) S T=PNM_" "_SSNP_" "_$G(PSONOW) D PRINT(T) S PSOY=PSOY+PSOYI
F JJ=6,7 S TEXT="" D P(JJ) S PSOY=PSOY+PSOYI Q:OUT
I $G(PSOIO("CNI"))]"" X PSOIO("CNI")
I $G(PSOCHAMP),$G(PSOTRAMT) S T="REMIT $"_PSOTRAMT_" TO AGENT CASHIER." D PRINT(T) G END
I 'PRCOPAY G END
S OUT=0,TEXT=""
I $D(^PS(59,PSOSITE,4)) S T=PNM_" "_SSNP_" "_$G(PSONOW) D PRINT(T) S PSOY=PSOY+PSOYI D P(4)
END K DIWF,DIWL,DIWR,EDT,LLL,PRCOPAY,PSNACNT,PSNOADDR,PSNOBOTH,PSNONARR,PSNOSUSP,PSNTHREE,PSOLGTH,PSOSD,PSOTRAIL,PSOTRDFN,PSSEVFL,PSSIXFL,PSSPCNT,PSSSRX,PSSUFLG,RXX,SPDATE,SPNUM,SPPL,TTT,VAADDR1,VADM,VAEL,VAPA,VASTREET,ZZ,ZZZ W @IOF
Q
P(JJ) ;NARRATIVE PRINT CONTROL
N TEXTLEN,PSOCNT
S TEXTLEN=0,PSOCNT=0
S ZZ=0 F S ZZ=$O(^PS(59,PSOSITE,JJ,ZZ)) Q:'ZZ S PSOCNT=PSOCNT+1 Q:PSOCNT>7 I $D(^(ZZ,0)) S TEXT=^(0),TEXTLEN=TEXTLEN+$L(TEXT) S:TEXTLEN>560 TEXTLEN=TEXTLEN-$L(TEXT),TEXT=$E(TEXT,1,560-TEXTLEN) Q:TEXT="" D Q:OUT
. N IC
. D STRT^PSOLLU1("SEC2",TEXT,.L)
. I L(XFONT)>4.1 D Q
.. S IC=0 F J=1:1:$L(TEXT," ") D STRT^PSOLLU1("SEC2",$P(TEXT," ",J)_" ",.L) I L(XFONT)>4.1 S IC=1
.. I IC D Q:OUT
... F J=$L(TEXT):-1:1 S PTEXT=$E(TEXT,1,J) D STRT^PSOLLU1("SEC2",PTEXT,.L) D Q:OUT
.... I L(XFONT)<4.1 D PRINT(PTEXT) S TEXT=$E(TEXT,J+1,512),J=$L(TEXT)+1,PTEXT="" I PSOY>PSOYM S OUT=1
.... Q
... Q
.. I IC D:PTEXT]"" PRINT(PTEXT) S:PSOY>PSOYM OUT=1 Q
.. F J=$L(TEXT," "):-1 S PTEXT=$P(TEXT," ",1,J) Q:OUT Q:'$L(PTEXT) D STRT^PSOLLU1("SEC2",PTEXT,.L) I L(XFONT)<4.1 D
... D PRINT(PTEXT) S TEXT=$P(TEXT," ",J+1,99) I PSOY>PSOYM S OUT=1
... ;Reset $L of TEXT +1 so J loop continues properly
... S J=$L(TEXT," ")+1
... Q
.. Q
. D PRINT(TEXT) S TEXT=""
. I PSOY>PSOYM S OUT=1
. Q
I 'OUT I TEXT]"" D PRINT(TEXT)
Q
PRINT(T) ;
I $G(PSOIO(PSOFONT))]"" X PSOIO(PSOFONT)
I $G(PSOIO("ST"))]"" X PSOIO("ST")
W T,!
I $G(PSOIO("ET"))]"" X PSOIO("ET")
Q