source: WorldVistAEHR/trunk/r/IFCAP-PRC-PRX--PRCA--PRCN/PRCHSF.m@ 1046

Last change on this file since 1046 was 613, checked in by George Lilly, 15 years ago

initial load of WorldVistAEHR

File size: 3.4 KB
Line 
1PRCHSF ;WISC/DM/SC/SJG-PLACES BOCS & AMOUNTS INTO PO FILE ;8/19/94 10:22 AM
2V ;;5.1;IFCAP;**79**;Oct 20, 2000
3 ;Per VHA Directive 10-93-142, this routine should not be modified.
4 ;NEW PO
5 ;TOTAL PO $ AMOUNT CALCULATIONS FOR FILE 442
6 ;THIS ROUTINE IS CALLED FROM: PRCHNPO1
7 ; PRCHNPO4
8 ; PRCHNRQ
9 ;
10 Q:$P(^PRC(442,DA,7),U,1)=45 L +^PRC(442,DA):1 I '$T W !," P.O. is being edited by another person !",$C(7) Q
11 S U="^",X=^PRC(442,DA,0),PRCHS("EST")=+$P(X,U,13),PRCHS("CP")=+$P(X,U,3),PRCHS("SITE")=+X I $D(^PRC(420,PRCHS("SITE"),1,PRCHS("CP"),0)),$P(^(0),U,12) S PRCHS("SP")=$P(^(0),U,12)
12 S IL=0 F S IL=$O(^PRC(442,DA,2,IL)) Q:IL=""!(IL'>0) S PRCHS=IL,PRCHS("N")=^(PRCHS,0),PRCHS("N2")=$G(^(2)),PRCHS("NS")=+$P(PRCHS("N"),U,4) D L
13 S (CNT,JL)=0 F S JL=$O(PRCHS("A",JL)) Q:JL=""!(JL<0) D LI2
14 S (PRCHS("TOT"),PRCHS("NET"),ML,PRCHS)=0
15 S BOCSHP=$G(^PRC(442,DA,23)),PRCHS(991)=+BOCSHP_"^"_PRCHS("EST") K BOCSHP
16 F S ML=$O(PRCHS(ML)) Q:ML=""!(ML'>0) I ML'=991 S PRCHS("TOT")=PRCHS("TOT")+$P(PRCHS(ML),U,2)
17 S PO=PRCHPO,PRC("BBFY")=$$BBFY^PRCFFU5(PRCHPO)
18 N PARAM K PRCHMO S PARAM=PRCHS("CP")_"^"_PRC("FY")_"^"_PRC("BBFY")
19 S PRCHMO=$$ACC^PRC0C(PRC("SITE"),PARAM)
20 S PRCHS("G/N")=$P(PRCHMO,U,12) K PRCHMO
21 I $D(PRCHS("G/N")) D:PRCHS("G/N")="G" LABEL,NET,UPDT D:PRCHS("G/N")="N" NET,UPDT,LABEL
22 G Q
23NET ;APPLY PROMPT PAY DISCOUNTS ONLY TO ZERO NODE IF FLAG="G"
24 D TM S PTM=0 F S PTM=$O(PRCHS(PTM)) Q:(PTM="")!(PTM'>0) I $P(PRCHS(PTM),U,2) I PTM'=991 S X=$P(PRCHS(PTM),U,2),$P(PRCHS(PTM),U,2)=(X-$J(X*PRCHS("T"),0,2)),PRCHS("NET")=PRCHS("NET")+$P(PRCHS(PTM),U,2)
25 Q
26 ;
27UPDT ;UPDATE ZERO NODE,CHECK ELECTRONIC SIGNATURE ETC.
28 I '$D(PRCSUM)&($P($G(^PRC(442,DA,12)),"^",2)]"") S PRCSUM=$$SUM^PRCUESIG(DA_"^"_$$STRING^PRCHES5(^PRC(442,DA,0),^PRC(442,DA,1),^PRC(442,DA,12)))
29 S PRCHS("NET")=PRCHS("NET")+PRCHS("EST"),PRCHS("TOT")=PRCHS("TOT")+PRCHS("EST"),$P(^PRC(442,DA,0),U,6,9)="^^^",$P(^(0),U,15,16)=PRCHS("TOT")_"^"_PRCHS("NET")
30 I $P($G(^PRC(442,DA,12)),"^",2)]"" S PRCSIG="",X=0 D
31 .D RECODE^PRCHES5(DA,PRCSUM,.PRCSIG)
32 .K PRCSUM,PRCSIG
33 .Q
34 ;
35 ;PRC*5.1*79: update field #133 for new FPDS report to Austin: send all
36 ;eligible purchase orders - requisitions are never required.
37 I $D(PRCHNRQ) Q
38 S:$D(^PRC(442,DA,25)) $P(^PRC(442,DA,25),U,17)=""
39 I PRCHS("TOT")>0,$P($G(^PRC(442,DA,9,1,0)),U,5)]"" S $P(^PRC(442,DA,25),U,17)="YES"
40 ;End of changes for PRC*5.1*79
41 Q
42 ;
43LABEL ;IF FLAG="G" THEN CALC. 22 NODE W/O PROMPT PAY. DISCOUNTS
44 K NODE,^PRC(442,DA,22) S NODE=$G(^PRC(442,DA,22,0)) I NODE="" S ^PRC(442,DA,22,0)="^"_$P(^DD(442,41,0),U,2)
45 S (CTR,I)=0 F S I=$O(PRCHS(I)) Q:I'>0 S CTR=$S(I=991:CTR,1:CTR+1),CTR=$S(CTR=991:992,1:CTR) D IT
46 Q
47 ;
48Q L -^PRC(442,DA) K PRCHS,IL,JL,CNT,CTR,ML,PTM,DIE,BOCSHP,FMSL,LICOST,NODE,AMT
49 Q
50 ;
51IT S:$D(DA(1)) PRCHDA1=DA(1) S DA(1)=DA
52 S DIC="^PRC(442,"_DA(1)_",22,",DIC(0)="L",X=+$P(PRCHS(I),U,1) K DD,DO D FILE^DICN I Y'>0 W !," ERROR " Q
53 N DA S FMSL=$S(I=991:991,1:CTR),DIE=DIC,DA=+Y,AMT=$P(PRCHS(I),U,2),DR="1////^S X=AMT;2////^S X=FMSL" D ^DIE K X,Y,DIE,DIC
54 S:$D(PRCHDA1) DA(1)=PRCHDA1 K PRCHDA1
55 Q
56 ;
57L S:'$D(PRCHS("A",PRCHS("NS"))) PRCHS("A",PRCHS("NS"))="" S LICOST=+$P(PRCHS("N2"),U,1),PRCHS("A",PRCHS("NS"))=+(PRCHS("A",PRCHS("NS")))+LICOST-$P(PRCHS("N2"),U,6)
58 Q
59 ;
60LI2 S CNT=CNT+1 S PRCHS(CNT)=JL_U_PRCHS("A",JL) K PRCHS("A",JL)
61 Q
62 ;
63TM ;
64 S PRCHS("T")=0 K I F I=0:0 S I=$O(^PRC(442,DA,5,I)) Q:'I S X=^(I,0) I +X>0 S I(100-X)=+X
65 S:$O(I(0)) PRCHS("T")=I($O(I(0))),PRCHS("T")=PRCHS("T")/100 K I Q
66 Q
Note: See TracBrowser for help on using the repository browser.