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

68 lines
4.7 KiB
Mathematica

PRCHPNT2 ;ID/RSD/RHD-CONT. OF PRINT ;5/4/98 14:17
V ;;5.1;IFCAP;;Oct 20, 2000
;Per VHA Directive 10-93-142, this routine should not be modified.
ITEM S DIWL=1,DIWR=33,DIWF="",PRCHD=0 K ^UTILITY($J,"W")
F K=0:0 S PRCHD=$O(^PRC(442,D0,2,PRCH,1,PRCHD)) Q:PRCHD=""!(PRCHD<0) S X=$G(^(PRCHD,0)) D DIWP^PRCUTL($G(DA))
S PRCHCNT=$G(^UTILITY($J,"W",1)),PRCHL=PRCHL+PRCHCNT+1 W !?2,$J($P(PRCHI2,U,5)_+$P(PRCHI0,U,1),3),?8,$G(^(1,1,0))
W ?48,$J($P(PRCHI0,U,2),7),?57,$P($G(^PRCD(420.5,+$P(PRCHI0,U,3),0)),U,1)
S X=$P($P(PRCHI0,U,9),".",2) W ?59,$S($L(X)>3:$J($P(PRCHI0,U,9),8,4),$L(X)>2:$J($P(PRCHI0,U,9),8,3),$P(PRCHI0,U,9)="N/C":" N/C",1:$J($P(PRCHI0,U,9),8,2)) S PRCHC=1 I $P(PRCHI2,U,1)<10000 D AMT
I PRCHCNT>1 F K=2:1:$P(^TMP($J,"P",P,PRCH),U,2) W:$D(^TMP($J,"W",1,K,0)) !?8,^(0) D:PRCHC AMT
W ! S PRCHL=PRCHL+1 I $P(PRCHI0,U,6)]"" W ?8,"STK#: ",$P(PRCHI0,U,6),! S PRCHL=PRCHL+1
I $P(PRCHI0,U,13)]"" W ?8,"NSN: ",$P(PRCHI0,U,13) D:$D(PRCHNRQ) PSNO^PRCHFPNT W ! S PRCHL=PRCHL+1
I $P($G(^PRC(442,D0,2,PRCH,4)),U,12)]"" W ?8,"FOOD GROUP: ",$P(^(4),U,12),! S PRCHL=PRCHL+1
D EDISTAT^PRCHUTL(D0,PRCH,.PRCHL)
I $P(PRCHI0,U,12) W ?8,"Items per ",$P($G(^PRCD(420.5,+$P(PRCHI0,U,3),0)),U,1),": ",$P(PRCHI0,U,12),! S PRCHL=PRCHL+1
D:PRCHC AMT Q
;
AMT W ?67,$J($P(PRCHI2,U,1),8,2) S PRCHC=0,PRCHPT=PRCHPT+$P(PRCHI2,U,1)
Q
;
FOB ;
I $P($G(^PRC(442,D0,0)),U,2)=25 D G FA
. N PRCA,PRCB,PRCC
. S PRCHINV(1)="** No Purchase Card Info",PRCHINV(2)="",PRCHINV(3)="",PRCHINV(4)="",PRCHINV(5)=""
. S PRCA=$P($G(^PRC(442,D0,23)),U,8) Q:PRCA'>0
. S PRCB=$G(^PRC(440.5,PRCA,0)) Q:PRCB=""
. S PRCC=$P(PRCB,U,8) S:PRCC>0 PRCC=$P($G(^VA(200,PRCC,0)),U)
. S PRCA=$P(PRCB,U,11),PRCHINV(1)="PURCHASE CARD HOLDER"
. S PRCHINV(2)=" "_$E(PRCC,1,25),PRCHINV(3)="PURCHASE CARD NAME"
. S PRCHINV(4)=" "_$E(PRCA,1,25),PRCHINV(5)=""
S PRCHINV(1)=$P(PRCHINV,U,1),PRCHINV(2)=$P(PRCHINV,U,2),X=3 S:$P(PRCHINV,U,3)]"" PRCHINV(X)=$P(PRCHINV,U,3),X=X+1 S:$P(PRCHINV,U,4)]"" PRCHINV(X)=$P(PRCHINV,U,4),X=X+1
S PRCHINV(X)=$P(PRCHINV,U,5)_", "_$P($G(^DIC(5,+$P(PRCHINV,U,6),0)),U,2)_" "_$P(PRCHINV,U,7) F X=X+1:1:5 S PRCHINV(X)=""
FA S PRCHSC=$P($G(^PRCD(420.8,+$P(PRCH1,U,7),0)),U,1) W !!?2,$S("O"=$E($P(PRCH1,U,6)):"ORIGIN","D"=$E($P(PRCH1,U,6)):"DESTINATION",1:""),?30,$J($P(PRCH1,U,14),3),?33,$S("2B"[PRCHSC:"X",1:"")
S DIWL=1,DIWR=16,DIWF="",X=$P(PRCH1,U,8) K ^UTILITY($J,"W") D DIWP^PRCUTL($G(DA))
W ?48,$G(^UTILITY($J,"W",1,1,0)),?69,PRCHINV(1),!?48,$G(^UTILITY($J,"W",1,2,0)),?69,PRCHINV(2)
W !?2,$P(PRCH12,U,7),?48,$G(^UTILITY($J,"W",1,3,0)),?69,PRCHINV(3)
;
DIS W !?24,"ON OR",?33,$S(PRCHSC]""&(PRCHSC'=2):"X",1:""),?69,PRCHINV(4),!?2
S PRCH=0 I $D(^PRC(442,D0,5,0)) F I=1:1:2 S PRCH=$O(^PRC(442,D0,5,PRCH)) Q:PRCH=""!(PRCH'>0) W $P(^(PRCH,0),U,4),$P(^(0),U,1) W:$P(^(0),U,1)=+$P(^(0),U,1) "%" W $P(^(0),U,2)," "
W ?14,"BEFORE",?23 S Y=$P(PRCH0,U,10) D DT S PRCH=0
;
CON F I=0:1:3 S PRCH=$O(^PRC(442,D0,2,"AC",PRCH)) Q:PRCH="" W:I=2 ?2,$P(PRCH12,U,8) S Y=$O(^(PRCH,0)) W:^(Y)]"" ?45,$J(^(Y),3) W ?49,PRCH W:I=0 ?69,PRCHINV(5) W !
F Y=I:1:4 W:Y=0 ?69,PRCHINV(5) W:Y=2 ?2,$P(PRCH12,U,8) W !
K PRCHHSP,PRCHINV,PRCHSHP,PRCHST,S,V S PRCHL=18,P=1,PRCH=0
;
CNTI S PRCH=$O(^PRC(442,D0,2,PRCH)) G:PRCH=""!(PRCH'>0) CNTD S PRCHLB=1,PRCHL1=$P(^(PRCH,2),U,4) S:$P(^(0),U,6)]"" PRCHL1=PRCHL1+1 S:$P(^(0),U,13)]"" PRCHL1=PRCHL1+1 S:$P(^(0),U,9) PRCHL1=PRCHL1+1 S:$P(^(0),U,11) PRCHL1=PRCHL1+1
S:$P(^PRC(442,D0,2,PRCH,0),U,9)!($P(^(0),U,11)) PRCHL1=PRCHL1+2
D P:PRCHL-1<PRCHL1 S ^TMP($J,"P",P,PRCH)=PRCHLB_U_PRCHL1,PRCHL=PRCHL-PRCHL1-1
G CNTI
;
CNTD S (PRCHLE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