source: FOIAVistA/tag/r/IFCAP-PRC-PRX--PRCA--PRCN/PRCFFU21.m@ 1700

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

initial load of FOIAVistA 6/30/08 version

File size: 4.6 KB
Line 
1PRCFFU21 ;WISC/SJG-FMS MO3 SEGMENT ;6/25/97 16:36
2V ;;5.1;IFCAP;;Oct 20, 2000
3 ;Per VHA Directive 10-93-142, this routine should not be modified.
4 ;
5MO3 ;BUILD 'MO3' SEGMENT
6 ; 7 - DELIVERY DATE (FILE 442)
7 ; 7.2 - ESTIMATED COST (FILE 442)
8 ; 9.2 - PROMPT PAYMENT TERMS (FILE 442)
9 ; 8.3 - PURCHASE METHOD (442.12)
10 ; 29 - END DATE (FILE 442)
11 ; 30 - AUTO ACCRUE (FILE 410)
12 ; 91 - TOTAL AMOUNT (FILE 442)
13 ; 92 - NET AMOUNT (FILE 442)
14 ; 5 - VENDOR (FILE 442)
15 ; .07 - PRIMARY 2237 REQUEST (FILE 442)
16 ; 11 - VENDOR (FILE 410)
17 ; 13 - VENDOR CONTRACT NUMBER (FILE 410)
18 ; 21 - DATE COMMITTED (FILE 410)
19 ; 52 - STA NO-PO NUM (FILE 410)
20 ;
21MO3A N SEG,DELDATE,FMSYR,FMSMO,FMSDAY,PPT,PM,TOT,CONT,START,VENID,PRIMREQ,VENCONT,CONTIEN,CONTEND,CONTBEG
22 S TMPLINE=TMPLINE+1,SEG="MO3^^^^^^^01"
23 K PRCTMP N DA S DIC=442,DR=".07;5;7.2;7;8.3;29;30;91;92",DA=+PO,DIQ="PRCTMP(",DIQ(0)="IE",DR(442.12)=".01",DA(442.12)=1 D EN^DIQ1 K DIC,DIQ,DR
24 I TRCODE="SO",PRCFA("MP")=21,$G(PRCCON3) S:$G(PRCTMP(442,+PO,92,"E"))]"" PRCTMP(442,+PO,91,"E")=PRCTMP(442,+PO,92,"E")
25MO3B D
26 .Q:(PRCFA("MP")=2)&(PRCFA("TT")="SO")
27 .I TYCODE="M" Q:(PRCFA("DEL")="")&(PRCFA("DELSCH")="")
28 .S DELDATE=PRCTMP(442,+PO,7,"I")
29 .S DELDATE=$$DELSCH^PRCFFU5(.DELDATE)
30 .S X1=BEGDATE,X2=DELDATE D ^%DTC I X>0 S DELDATE=BEGDATE
31 .D DATE(DELDATE,.A,.B,.C) S DELDATE=FMSYR_U_FMSMO_U_FMSDAY
32 .S $P(SEG,U,9)=DELDATE
33MO3C I TRCODE="MO" D
34 .S PM=$G(PRCTMP(442.12,1,.01,"I"))
35 .S CONT="" I $D(^PRC(442,+PO,2,"AC"))\10 S START="",CONT=$O(^PRC(442,+PO,2,"AC",START))
36 .I TYCODE="E" S:PRCFMO("G/N")="G" TOT=$G(PRCTMP(442,+PO,91,"E")) S:PRCFMO("G/N")="N" TOT=$G(PRCTMP(442,+PO,92,"E")) S TOT=$FN(TOT,"",2),$P(SEG,U,27)=TOT
37 .I TYCODE="M" D
38 ..Q:'$D(PRCFCHG("BOC"))
39 ..S TOT=$FN(TOTAMT,"",2),$P(SEG,U,27)=TOT
40 .I $G(CONT)]"" I TRCODE'="MO" S $P(SEG,U,33)=$E(CONT,1,10)
41MO3D I TRCODE="SO"&(PRCFA("MP")=21) D
42 .S VENID=$G(PRCTMP(442,+PO,5,"I")),PRIMREQ=$G(PRCTMP(442,+PO,.07,"I"))
43 .S PRCFA("AUTOACC")=$E($G(PRCTMP(442,+PO,30,"E")),1)
44 .I PRIMREQ]"" D
45 ..N DA S DA=+PRIMREQ,DIC=410,DR="13;21;52",DIQ="PRCTMP(",DIQ(0)="IEN" D EN^DIQ1 K DIC,DIQ,DR
46 ..I TYCODE="M" D
47 ...N POIEN S POIEN=$G(PRCTMP(410,PRIMREQ,52,"I"))
48 ...I POIEN]"" D
49 ....N ORGIEN S ORGIEN=$G(PRCTMP(442,POIEN,.07,"I"))
50 ....D GENDIQ^PRCFFU7(410,ORGIEN,"11;13;21","IEN","")
51 ....Q
52 ...Q
53 ..I PRCFA("AUTOACC")="" S PRCFA("AUTOACC")="N"
54 ..S VENCONT=$G(PRCTMP(410,+PRIMREQ,13,"E"))
55 ..I VENID]""&(VENCONT]"")&($G(PRCTMP(442,+PO,29,"I"))="") D Q
56 ...S DIC="^PRC(440,"_VENID_",4,",DIC(0)="MNQZ",X=VENCONT D ^DIC K DIC
57 ...S CONTIEN=+Y
58 ...N DA S DIC=440,DR=6,DA=+VENID,DIQ="PRCTMP(",DIQ(0)="IEN",DR(440.03)=".5;1",DA(440.03)=CONTIEN D EN^DIQ1 K DIC,DIQ,DR
59 ...S CONTEND=$G(PRCTMP(440.03,CONTIEN,1,"I")) I CONTEND]"" S CONTEND=$$DATE2(CONTEND),$P(SEG,U,9)=CONTEND
60 ...S CONTBEG=$G(PRCTMP(440.03,CONTIEN,.5,"I")) I CONTBEG]"" S CONTBEG=$$DATE2(CONTBEG),$P(SEG,U,18)=CONTBEG
61 ..I $G(PRCTMP(442,+PO,29,"I"))]"" D Q
62 ...S ENDDATE=$G(PRCTMP(442,+PO,29,"I")) I ENDDATE]"" S ENDDATE=$$DATE2(ENDDATE),$P(SEG,U,9)=ENDDATE
63 ...S BEGDATE=$G(PRCTMP(410,+PRIMREQ,21,"I")) I PRCFA("AUTOACC")["Y" I BEGDATE]"" S BEGDATE=$$DATE2(BEGDATE),$P(SEG,U,18)=BEGDATE
64 ...Q
65 ..S ENDDATE=$G(PRCTMP(442,+PO,29,"I")) I ENDDATE="" D NOW^%DTC S ENDDATE=$$DATE2(X),$P(SEG,U,9)=ENDDATE
66 ..Q
67 .I TYCODE="E" D
68 ..I PRCFA("MP")=21 S TOT=$G(PRCTMP(442,+PO,91,"E")),TOT=$FN(TOT,"",2),$P(SEG,U,27)=TOT
69 ..I PRCFA("MP")=1!(PRCFA("MP")=8)!(PRCFA("MP")=2) S TOT=$G(PRCTMP(442,+PO,92,"E")),TOT=$FN(TOT,"",2),$P(SEG,U,27)=TOT
70 .I TYCODE="M" D
71 ..I PRCFA("MP")=21 S TOT=$G(PRCTMP(442,+PO,7.2,"E")),TOT=$FN(TOT,"",2),$P(SEG,U,27)=TOT
72 ..I PRCFA("MP")=2 Q:'$D(PRCFCHG("BOC")) S TOT=$FN(TOTAMT,"",2),$P(SEG,U,27)=TOT
73 .I $G(VENCONT) S $P(SEG,U,33)=$E(VENCONT,1,10)
74MO3E I TRCODE="SO"&(PRCFA("MP")=2) D
75 .S PRCFA("AUTOACC")=$E($G(PRCTMP(442,+PO,30,"E")),1) S:PRCFA("AUTOACC")="" PRCFA("AUTOACC")="N"
76 .S ENDDATE=$G(PRCTMP(442,+PO,29,"I")) I ENDDATE]"" S ENDDATE=$$DATE2(ENDDATE),$P(SEG,U,9)=ENDDATE
77 .S BEGDATE=PRCFA("OBLDATE") I BEGDATE]"" S BEGDATE=$$DATE2(BEGDATE),$P(SEG,U,18)=BEGDATE
78 .I TYCODE="E",PRCFA("MP")=2 S TOT=$G(PRCTMP(442,+PO,92,"E")),TOT=$FN(TOT,"",2),$P(SEG,U,27)=TOT
79 .I TYCODE="M",PRCFA("MP")=2 Q:'$D(PRCFCHG("BOC")) S TOT=$FN(TOTAMT,"",2),$P(SEG,U,27)=TOT
80 .N LOOP S LOOP="",VENCONT=$O(^PRC(442,+PO,2,"AC",LOOP))
81 .I $G(VENCONT) S $P(SEG,U,33)=$E(VENCONT,1,10)
82 .Q
83 S ^TMP($J,"PRCMO",INT,TMPLINE)=SEG_"^~" K PRCTMP
84 Q
85 ;
86DATE(X,A,B,C) ;
87 S FMSYR=$E(X,2,3),FMSMO=$E(X,4,5),FMSDAY=$E(X,6,7)
88 Q
89DATE1(X) ;
90 Q $E(X,4,5)_$E(X,6,7)_$E(X,2,3)
91DATE2(Y) ;
92 Q $E(Y,2,3)_U_$E(Y,4,5)_U_$E(Y,6,7)
93ASKDATE(X) ;
94 N Y,ASKDATE
95 S %DT="AEX",%DT("A")=X D ^%DT
96 S ASKDATE=Y K %DT
97 Q ASKDATE
Note: See TracBrowser for help on using the repository browser.