VistA-FOIAVistA/r/IFCAP-PRC-PRX--PRCA--PRCN/PRCPRIB0.m

42 lines
2.5 KiB
Mathematica

PRCPRIB0 ;WISC/RFJ-issue book request form(called from ifcap only) ;22 Dec 92
;;5.1;IFCAP;;Oct 20, 2000
;Per VHA Directive 10-93-142, this routine should not be modified.
Q
;
;
DQ ; called from ifcap (not prcp*) to print issue book request
; form
; prcprib = internal entry to 410
N %,%H,%I,CLASS,D,DATA,DEPART,DESCNSN,DESCR,ITEMDA,ITEMDATA,LINEDA,LINEITEM,MULTIPLE,NOW,NOWDT,NSN,P,PAGE,PRCPDA,PRCPFLAG,PRIMARY,PRIMDATA,SCREEN,SORT,STAR,TEMPLVL,TOTAL,TRANDAT1,TRANDAT3,TRANDAT7,TRANDAT9,TRANDATA,USER,VENDOR,X,Y
S PRCPDA=+$G(PRCPRIB),TRANDATA=$G(^PRCS(410,PRCPDA,0)) I TRANDATA="" W !!,"ERROR -- NUMBER '",PRCPDA,"' NOT IN CONTROL POINT ACTIVITY FILE" Q
S PRIMARY=+$P(TRANDATA,"^",6),PRIMDATA=$G(^PRCP(445,PRIMARY,0))
S SORT=$P($G(^PRC(411,+TRANDATA,0)),"^",21) I $TR($P(PRIMDATA,"^",10),"S")'="" S SORT=$P(PRIMDATA,"^",10)
S:SORT="" SORT="N"
;
S TRANDAT1=$G(^PRCS(410,PRCPDA,1)),%=$P(TRANDAT1,"^",3),$P(TRANDAT1,"^",3)=$S(%="ST":"STANDARD",%="EM":"EMERGENCY",%="SP":"SPECIAL",1:"<< NOT SPECIFIED >>")
S Y=$P(TRANDAT1,"^") D DD^%DT S $P(TRANDAT1,"^")=Y,Y=$P(TRANDAT1,"^",4) D DD^%DT S $P(TRANDAT1,"^",4)=Y
S CLASS=$P($G(^PRCS(410.2,+$P(TRANDAT1,"^",5),0)),"^")
;
S TRANDAT3=$G(^PRCS(410,PRCPDA,3)),VENDOR=+$P(TRANDAT3,"^",4)
S DEPART=$P($G(^PRC(420,+TRANDATA,1,+$P(TRANDATA,"-",4),0)),"^",18)
S:DEPART="" DEPART=$P($G(^PRCP(445,PRIMARY,0)),"^",8) I DEPART'="" S DEPART=DEPART_" "_$$INVNAME^PRCPUX1(PRIMARY)
S:DEPART="" DEPART=$P($G(^DIC(49,+$P(TRANDAT3,"^",5),0)),"^")
;
S TRANDAT7=$G(^PRCS(410,PRCPDA,7)),USER=$P($G(^VA(200,+TRANDAT7,0)),"^")
S TRANDAT9=$G(^PRCS(410,PRCPDA,9))
;
D NOW^%DTC S (NOWDT,Y)=% D DD^%DT S NOW=Y
K ^TMP($J,"PRCPIB")
S LINEDA=0 F S LINEDA=$O(^PRCS(410,PRCPDA,"IT",LINEDA)) Q:'LINEDA S D=$G(^(LINEDA,0)) I D'="" D
. S LINEITEM=+$P(D,"^"),ITEMDA=+$P(D,"^",5),ITEMDATA=$G(^PRCP(445,PRIMARY,1,ITEMDA,0))
. S TEMPLVL="" I $P(ITEMDATA,"^",23),$P(ITEMDATA,"^",24)>NOWDT S TEMPLVL=$P(ITEMDATA,"^",23)
. S STAR="",MULTIPLE=$P($G(^PRC(441,ITEMDA,2,VENDOR,0)),"^",11) I MULTIPLE S %=$P(D,"^",2)/MULTIPLE I $P(%,".",2) S STAR="*"
. S DESCR=$G(^PRCS(410,PRCPDA,"IT",LINEDA,1,1,0)) I DESCR="" S DESCR=$$DESCR^PRCPUX1(PRIMARY,ITEMDA)
. S NSN=$$NSN^PRCPUX1(ITEMDA)
. S DESCNSN=$S(SORT="A":DESCR,1:NSN) S:DESCNSN="" DESCNSN=" "
. S ^TMP($J,"PRCPRIB",DESCNSN,LINEITEM,LINEDA)=$$UNITCODE^PRCPUX1(+$P(D,"^",3))_"^"_+$P(ITEMDATA,"^",9)_"^"_+$P(ITEMDATA,"^",7)_"^"_TEMPLVL_"^"_MULTIPLE_"^"_STAR_"^"_DESCR_"^"_NSN
D PRINT^PRCPRIB1
K ^TMP($J,"PRCPRIB")
S:$D(ZTQUEUED) ZTREQ="@"
Q