source: WorldVistAEHR/trunk/r/IFCAP-PRC-PRX--PRCA--PRCN/PRCFDA2.m@ 623

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

initial load of WorldVistAEHR

File size: 7.7 KB
RevLine 
[613]1PRCFDA2 ;WISC@ALTOONA/CTB/BGJ-PROCESS PAYMENT TO FMS ; 9/28/99 4:12pm
2V ;;5.1;IFCAP;;Oct 20, 2000
3 ;Per VHA Directive 10-93-142, this routine should not be modified.
4EN S PRCTXD=$P($G(^PRCF(421.5,PRCF("CIDA"),1)),U,19)
5 S DIE=421.5,DA=PRCF("CIDA")
6 S DR="71R//^S X=$$DATE^PRCFDA2(PRCF(""PODA""),PRC10DA);S PRCTXD=$E(X,1,5)*100;72////^S X=PRCTXD;S Y=""@1"";@1;72R//^S X=$$MONYR^PRCFDA2(PRCTXD)"
7 D ^DIE K DIE,DR,DA I $D(DTOUT)!$D(Y) G OT^PRCFDA
8 S PRCF("MOP")=$P($G(^PRC(442,PRCF("PODA"),0)),U,2)
9 S X=$P($P($G(^PRC(442,PRCF("PODA"),10,1,0)),U),".",1,2)
10 S PRCF("TC")=$P(X,".",1)
11 S PRCF("TC")=$S(PRCF("TC")?2U:PRCF("TC"),PRCF("MOP")=2:"SO",PRCF("MOP")=21:"SO",1:"MO")
12 I PRCF("TC")="SO" D
13 . N PRCFATT
14 . S PRCFATT=PRCF("TC")
15 . D SOAR^PRC0E(PRCF("PODA"),.PRCFATT,2) ; ask post against SO OR AR?
16 . S PRCF("TC")=PRCFATT
17 I "^AR^SO^MO"'[("^"_PRCF("TC")) G OT^PRCFDA
18 S X=$P($G(^PRCF(421.5,PRCF("CIDA"),1)),U,19,20),Y=$P(X,U,2),X=$P(X,U)
19 S:$G(DT)>X X=DT S DIR(0)="YA",DIR("B")="YES"
20 S DIR("A",1)="Your FMS document will be transmitted on "_$E(X,4,5)_"/"_$E(X,6,7)_"/"_$E(X,2,3)_" and will affect the"
21 S DIR("A")="accounting period "_$$MONYR(Y)_". Is this okay? "
22 D ^DIR K DIR G OT^PRCFDA:$D(DIRUT),EN:Y<1
23SIG D SIG^PRCFACX0 I $D(PRCFA("SIGFAIL")) K PRCFA("SIGFAIL") G OT^PRCFDA
24 S DA=PRCF("CIDA"),MESSAGE=""
25 D REMOVE^PRCFDES2(DA),ENCODE^PRCFDES2(DA,DUZ,.MESSAGE)
26 K MESSAGE,DA
27 S ACTION="E" K ^TMP($J,"PRCPV")
28 ;I $D(PRCFA("ERROR PROCESSING")) S ACTION="M"
29 S N1=$G(^PRCF(421.5,PRCF("CIDA"),1))
30 S PRCF("PO")=$P(N1,U,3),PRCF("PA")=$P(N1,U,6)
31 I PRCF("PA")="" D G:PRCF("PA")="" EX
32NEXT . ; Obtain next available Partial# for the PO
33 . N K,DA S K=0,Y=$O(^PRCF(421.9,"B",PRCF("PO"),0))
34 . I Y="" S X=PRCF("PO"),DIC="^PRCF(421.9,",DLAYGO=421.9,DIC(0)="XL"
35 . I Y="" K DO,DINUM,DIC("DR") D FILE^DICN S %=0 K DIC,DLAYGO Q:Y<0
36 . S DA=Y
37 . S Y1=$P(^PRCF(421.9,+DA,0),"^",2)+1
38 . I Y1>949,Y1<974 S X="WARNING: This partial, number "_Y1_", is approaching the limit of 974 permitted by the system." W !! D MSG^PRCFQ W $C(7),$C(7),$C(7),$C(7)
39 . I Y1=974 S X="WARNING: This partial, number "_Y1_", is the last permitted by the system." W !! D MSG^PRCFQ W $C(7),$C(7),$C(7),$C(7)
40 . I Y1=974 S DIR(0)="Y",DIR("A")="Do you wish to continue",DIR("B")="NO" D ^DIR I $D(DIRUT)!(Y=0) K DIR,Y1,DA Q
41 . I Y1>974 S X="WARNING: THIS PARTIAL, NUMBER "_Y1_", HAS EXCEEDED THE SYSTEM LIMIT OF 974. UNABLE TO PROCESS THIS TRANSACTION." D Q
42 . . S X=X_" IF NECESSARY, A PV DOCUMENT WILL HAVE TO BE CREATED ON-LINE IN FMS." W !! D MSG^PRCFQ W $C(7),$C(7),$C(7),$C(7) K Y1,DA
43 . L +^PRCF(421.9):5 I '$T S X="Partial Number file unavailable - File lock timeout.*" D MSG^PRCFQ K Y1,DA,DIR Q
44 . S Y(0)=^PRCF(421.9,+DA,0),Y1=$P(Y(0),"^",2)+1
45 . S $P(^PRCF(421.9,+DA,0),"^",2)=Y1
46 . L -^PRCF(421.9) D ALPHA^PRCFPAR(Y1,.X) S PRCF("PA")=X
47 . K Y(0),Y1,X,DA,DIR
48 . S $P(^PRCF(421.5,PRCF("CIDA"),1),U,6)=PRCF("PA")
49 . Q
50 ;
51 S:PRCF("PA")?1N PRCF("PA")="0"_PRCF("PA")
52 S XPO=$P(PRCF("PO"),"-",1)_$P(PRCF("PO"),"-",2)_PRCF("PA")
53 S PRCF("TN")=$E(XPO,1,9)_$S(PRCF("TC")="AR":12,1:" ")
54 S X="Transferring invoice data to PV document for transmission to FMS.*"
55 W ! D MSG^PRCFQ,NEW^PRCFD8(PRCF("CIDA"),ACTION)
56 I '$D(PRCFA("ERROR PROCESSING")) D G:'$D(GECSFMS("DA")) EX
57 . I $G(^%ZOSF("TEST")) S X="GECSUFMS" X ^%ZOSF("TEST") I '$T S X="Generic Code Sheet routine GECSUFMS missing - cannot continue.*" D MSG^PRCFQ Q
58 . D CONTROL^GECSUFMS("I",+PRC("SITE"),XPO,"PV",$$SEC1^PRC0C(PRC("SITE")),0,"","Payment Voucher")
59 . I '$D(GECSFMS("DA")) S X="No new FMS Payment Voucher created - Files inaccessible at this time.*" D MSG^PRCFQ
60 . Q
61 I $D(PRCFA("ERROR PROCESSING")) S CODESHET=0 D G:'$D(GECSDATA) EX
62 . I $G(^%ZOSF("TEST")) S X="GECSSGET" X ^%ZOSF("TEST") I '$T S X="Generic Code Sheet routine GECSSGET missing - cannot continue.*" D MSG^PRCFQ Q
63 . S DOCID="PV-"_XPO D DATA^GECSSGET(DOCID,CODESHET)
64 . I '$D(GECSDATA) S X="FMS Payment Voucher not rebuilt or transmitted - could not locate original PV in local stack file.*" D MSG^PRCFQ Q
65 . S PRCFD("STACK")=GECSDATA
66 . I $G(^%ZOSF("TEST")) S X="GECSUFM1" X ^%ZOSF("TEST") I '$T S X="Generic Code Sheet routine GECSUFM1 missing - cannot continue.*" D MSG^PRCFQ K GECSDATA Q
67 . D REBUILD^GECSUFM1(GECSDATA,"I",$$SEC1^PRC0C(PRC("SITE")),"","Payment Voucher Retransmission")
68 . Q
69 I $D(GECSFMS("DA"))=0,+$G(PRCFD("STACK")) S GECSFMS("DA")=PRCFD("STACK")
70 I $G(^%ZOSF("TEST")) S X="GECSSTAA" X ^%ZOSF("TEST") I '$T S X="Generic Code Sheet routine GECSSTAA missing - cannot continue.*" D MSG^PRCFQ G EX
71 S IX=0 F S IX=$O(^TMP($J,"PRCPV",IX)) Q:'IX D SETCS^GECSSTAA(GECSFMS("DA"),^(IX))
72 D SETSTAT^GECSSTAA(GECSFMS("DA"),"Q")
73 S X="PV document is complete and is queued for transmission to FMS.*"
74 ; Save GECS Stack File PV # in Invoice record:
75 S DIE=421.5,DA=PRCF("CIDA"),DR="27///^S X=XPO" D ^DIE K DA,DIE,DR
76 D MSG^PRCFQ S X=20 D STATUS^PRCFDE1
77 ; Post FMS Document Information to Purchase Order:
78 S PRCFA("SYS")="FMS",PRCFA("PODA")=PRCF("PODA"),POESIG=1
79 S XA="PV",XB=0 S:ACTION="M" XB=1
80 S XC=$P($G(^PRCF(421.5,PRCF("CIDA"),1)),U,19) S:XC="" XC=$P(^PRCF(421.5,PRCF("CIDA"),0),U,5)
81 S XD=$P(PRCF("PO"),"-",2)
82 D EN7^PRCFFU41(XA,XB,XC,XD)
83EX L:$D(PRCF("CIDA")) -^PRCF(421.5,PRCF("CIDA"))
84 K ACTION,N1,XPO,IX,XA,XB,XC,XD,DOCID,GECSDATA,GECSFMS,POESIG
85 K BOC,CNT,LAMT,D0,LD,FMSTYPE,GO,LABEL,LOOP
86 K RECORD,RECORD1,RESP,RETRAN,STATUS,TXT,VAR,PRCFX,MOP,PO,PONUM,PRC
87 K PRCF,PRCFD,PRC10DA,PRCTXD,X,Y,FMSLN,IEN,DIC
88 K PRCTMP,PATDA,CODESHET
89 K ^TMP($J,"PRCPV")
90 I $D(PRCFA("ERROR PROCESSING")),PRCFA("ERROR PROCESSING")'=2 K PRCFA Q
91 K PRCFA
92 I $D(DUOUT)!$D(DTOUT)!$D(DIRUT)!$D(DIROUT) K DUOUT,DTOUT,DIRUT,DIROUT Q
93 G ^PRCFDA
94 ;
95DATE(A,B) ;Returns in external format, the greater of Today and the
96 ;original obligation date
97 N X,Y S X=$P($P($G(^PRC(442,A,10,B,0)),U),".",3)
98 S:X'="" X=$S(+$E(X,5,6)<80:3,1:2)_$E(X,5,6)_$E(X,1,2)_$E(X,3,4)
99 S:$P($G(DT),".")>X X=$P(DT,".")
100 S Y=$P("JAN~FEB~MAR~APR~MAY~JUN~JUL~AUG~SEP~OCT~NOV~DEC","~",+$E(X,4,5))
101 S Y=Y_" "_+$E(X,6,7)_", "_(1700+$E(X,1,3))
102 Q Y
103MONYR(X) ;Returns External Month and Day from FileMan Date
104 N Y
105 I X'?7N.E S Y="" Q Y
106 S Y=$P("JAN~FEB~MAR~APR~MAY~JUN~JUL~AUG~SEP~OCT~NOV~DEC","~",+$E(X,4,5))
107 S Y=Y_" "_(1700+$E(X,1,3))
108 Q Y
109ASK ; If there are more than one BOC on the obligation ask the user for
110 ; the BOC to be processed.
111 S DIR(0)="NO"
112 N PRCFBOC S PRCFBOC=""
113 S DIR("A")="Select FMS LINE BOC: "
114 S DIR("B")=$O(PRCFX("SA",PRCFBOC))
115 S DIR("?")="^D HELP^PRCFDA2"
116 S DIR("??")="^W !!?15,""You may only enter a BOC from Obligation ""_PRCF(""CIDA"")"
117 D ^DIR I $D(DIRUT) S PRCFEX=1 Q
118 I '$D(DIRUT) S PRCFFLG=1
119 I '$D(PRCFX("SA",X)) K X W "??" G BOC^PRCFDA
120 S BOC=Y
121ASK2 ;checks to see if there are >1 FMS lines on a particular BOC
122 ;also an entry pointfor when there is only 1 BOC to check to
123 ;if there are >1 FMS line on that BOC
124 N CNT2,PRCFEE,PRCNOBOC S CNT2=""
125 S PRCFNUM="" F S PRCFNUM=$O(PRCFX("SA",BOC,PRCFNUM)) Q:'PRCFNUM S CNT2=CNT2+1
126 I CNT2>1 D I $G(PRCNOBOC)=1 G BOC^PRCFDA
127 . W !!,"Choose from: "
128 . S PRCFEE="" F S PRCFEE=$O(PRCFX("SA",BOC,PRCFEE)) Q:'PRCFEE W !?5,PRCFEE_" "_BOC_" "_$S($P($G(PRCFX("SA",BOC,PRCFEE)),U,2)=991:"Shipping",1:"Goods/Services")
129 . S DIR(0)="NOA"
130 . S DIR("A")="Enter the number of your choice: "
131 . S DIR("T")=30
132 . D ^DIR I $D(DIRUT) S PRCFEXIT=1 Q
133 . I '$D(DIRUT) S PRCFFLG=1
134 . I '$D(PRCFX("SA",BOC,X)) K X W "??" S PRCNOBOC=1
135 . S PRCFNUM=Y
136 . Q
137 I CNT2=1 S PRCFNUM=0 S PRCFNUM=$O(PRCFX("SA",BOC,PRCFNUM)) I $G(CNT1)=1 S PRCFFLG=2
138 Q
139HELP ;Help for BOC look-up
140 N NUM,NUM2
141 W ?5,"Answer with a BOC from this Obligation.",!
142 S NUM=""
143 S NUM=$O(PRCFX("SA",NUM)) Q:'NUM D
144 . I $O(PRCFX("SA",NUM))]"" W !?10,"Choose from: " Q
145 S (NUM,NUM2)=""
146 F S NUM=$O(PRCFX("SA",NUM)) Q:'NUM D
147 . F S NUM2=$O(PRCFX("SA",NUM,NUM2)) Q:'NUM2 D
148 . . W !?15,NUM," ",$S($P(PRCFX("SA",NUM,NUM2),U,2)=991:"Shipping",1:"Goods/Services")
149 Q
Note: See TracBrowser for help on using the repository browser.