PRC0G ;WISC/PLT-IFCAP UTILITY ; 02/19/96 3:37 PM
V ;;5.1;IFCAP;**230**;Oct 20, 2000;Build 1
;;Per VA Directive 6402, this routine should not be modified.
QUIT ;invalid entry
;
;prca data ^1=station #, ^2=fcp code,
; ^3=year (yyyy) or (yy optional for fiscal year only),
; ^4=F if fiscal year, else bbfy year
QTRDT(PRCA) ;ef - ^1=first qtr date, ^2=last qtr date, ^3=oldest open qtr date for this bbfy & ebfy
; ^4=true if revolving fund, ^5=todays qtr date
N PRCRI,PRCB,PRCC
N A,B,C,D,E,X,Y
S (A,B,C,D,E)=""
I $P(PRCA,"^",4)="F" S $P(PRCA,"^",3)=$$BBFY^PRCSUT($P(PRCA,"^",1),$P(PRCA,"^",3),$P(PRCA,"^",2),1)
;S PRCB=$$ACC^PRC0C(+PRCA,$P(PRCA,"^",2)_"^"_$E($P(PRCA,"^",3),1,2)_"^"_$P(PRCA,"^",3))
S PRCB=$$ACC^PRC0C(+PRCA,$P(PRCA,"^",2)_"^"_$E($P(PRCA,"^",3),3,4)_"^"_$P(PRCA,"^",3)) ;PRC*5.1*230
I $P(PRCB,"^",5)]"" S D=$O(^PRCD(420.3,"B",$P(PRCB,"^",5),"")) I D S D=$P($G(^PRCD(420.3,D,0)),"^",8)="Y" S:D $P(PRCB,"^",7)=2099
I $P(PRCB,"^",6) S A=$P($$QTRDATE^PRC0D($P(PRCB,"^",6),1),"^",7),B=$P($$QTRDATE^PRC0D($P(PRCB,"^",7),4),"^",7)
S C=$P($G(^PRC(420,+PRCA,0)),"^",9)
S C=$S(C<A:A,B<C:B,1:C)
S E=$$DATE^PRC0C(+$H,"H"),E=$P($$QTRDATE^PRC0D(+E,$P(E,"^",2)),"^",7)
QUIT A_"^"_B_"^"_C_"^"_D_"^"_E
;
;prca data ^1=ri of file 410, ^2=quarter beginning date (FM DATE)
E410(PRCA) ;edit running balance quarter date field 449
N X
D EDIT^PRC0B(.X,"410;^PRCS(410,;"_$P(PRCA,"^"),"449////"_$P(PRCA,"^",2),"LS")
QUIT
;
;prca data ^1=ri of file 410, ^2=status code E, A, O, or C.
ERS410(PRCA) ;edit running balance status field 450, and rb quarter date field 449 if nil
N A,B,C,D,X,Y
S A=$G(^PRCS(410,+PRCA,0)) QUIT:A=""
S B=""
I $P(A,"^",11)="" D
. S B=$G(^PRCS(410,+PRCA,3)),B=$P(B,"^",11)
. S B=$S(B="":$P(A,"-",2)_"^F",1:+$$DATE^PRC0C(B,"I"))
. S C=$$QTRDT($P(A,"-",1)_"^"_$P(A,"-",4)_"^"_B)
. S D=$$QTRDATE^PRC0D($P(A,"-",2),$P(A,"-",3)),D=$P(D,"^",7)
. S B=$S(D<$P(C,"^",3):$P(C,"^",3),$P(C,"^",2)<D:$P(C,"^",2),1:D)
. S B="449////"_B_";"
. QUIT
I $P(PRCA,"^",2)]"" S B=B_"450////"_$P(PRCA,"^",2)
I B]"" D EDIT^PRC0B(.X,"410;^PRCS(410,;"_$P(PRCA,"^"),B,"LS")
QUIT
;
;prca data ^1=station #, ^2=running balance quarter date (fileman date)
;prcb = obligation, p.o. or amendment date (fileman date)
OBDT(PRCA,PRCB) ;ef value = true if rb qtr date and obl/p.o./amend are compatible
N A,B,C
S A=$$DATE^PRC0C(PRCB,"I"),A=$P($$QTRDATE^PRC0D(+A,$P(A,"^",2)),"^",7)
S B=$P($G(^PRC(420,+PRCA,0)),"^",9)
S C=$S($P(PRCA,"^",2)'>B:B,1:$P(PRCA,"^",2))
QUIT A=C
;
;A data ^1=station #, ^2=fiscal year, ^3=quarter year, ^4=fcp code
; ^5=BBFY
RBDT(A) ;ef=runing balance (quarter) date
N B,C,D
S C=$$QTRDT($P(A,"^",1)_"^"_$P(A,"^",4)_"^"_$S($P(A,"^",5):$P(A,"^",5),1:$P(A,"^",2)_"^F"))
S D=$$QTRDATE^PRC0D($P(A,"^",2),$P(A,"^",3)),D=$P(D,"^",7)
S B=$S(D<$P(C,"^",3):$P(C,"^",3),$P(C,"^",2)<D:$P(C,"^",2),1:D)
QUIT B
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HPRC0G 2943 printed Dec 13, 2024@01:59:19 Page 2
PRC0G ;WISC/PLT-IFCAP UTILITY ; 02/19/96 3:37 PM
V ;;5.1;IFCAP;**230**;Oct 20, 2000;Build 1
+1 ;;Per VA Directive 6402, this routine should not be modified.
+2 ;invalid entry
QUIT
+3 ;
+4 ;prca data ^1=station #, ^2=fcp code,
+5 ; ^3=year (yyyy) or (yy optional for fiscal year only),
+6 ; ^4=F if fiscal year, else bbfy year
QTRDT(PRCA) ;ef - ^1=first qtr date, ^2=last qtr date, ^3=oldest open qtr date for this bbfy & ebfy
+1 ; ^4=true if revolving fund, ^5=todays qtr date
+2 NEW PRCRI,PRCB,PRCC
+3 NEW A,B,C,D,E,X,Y
+4 SET (A,B,C,D,E)=""
+5 IF $PIECE(PRCA,"^",4)="F"
SET $PIECE(PRCA,"^",3)=$$BBFY^PRCSUT($PIECE(PRCA,"^",1),$PIECE(PRCA,"^",3),$PIECE(PRCA,"^",2),1)
+6 ;S PRCB=$$ACC^PRC0C(+PRCA,$P(PRCA,"^",2)_"^"_$E($P(PRCA,"^",3),1,2)_"^"_$P(PRCA,"^",3))
+7 ;PRC*5.1*230
SET PRCB=$$ACC^PRC0C(+PRCA,$PIECE(PRCA,"^",2)_"^"_$EXTRACT($PIECE(PRCA,"^",3),3,4)_"^"_$PIECE(PRCA,"^",3))
+8 IF $PIECE(PRCB,"^",5)]""
SET D=$ORDER(^PRCD(420.3,"B",$PIECE(PRCB,"^",5),""))
IF D
SET D=$PIECE($GET(^PRCD(420.3,D,0)),"^",8)="Y"
if D
SET $PIECE(PRCB,"^",7)=2099
+9 IF $PIECE(PRCB,"^",6)
SET A=$PIECE($$QTRDATE^PRC0D($PIECE(PRCB,"^",6),1),"^",7)
SET B=$PIECE($$QTRDATE^PRC0D($PIECE(PRCB,"^",7),4),"^",7)
+10 SET C=$PIECE($GET(^PRC(420,+PRCA,0)),"^",9)
+11 SET C=$SELECT(C<A:A,B<C:B,1:C)
+12 SET E=$$DATE^PRC0C(+$HOROLOG,"H")
SET E=$PIECE($$QTRDATE^PRC0D(+E,$PIECE(E,"^",2)),"^",7)
+13 QUIT A_"^"_B_"^"_C_"^"_D_"^"_E
+14 ;
+15 ;prca data ^1=ri of file 410, ^2=quarter beginning date (FM DATE)
E410(PRCA) ;edit running balance quarter date field 449
+1 NEW X
+2 DO EDIT^PRC0B(.X,"410;^PRCS(410,;"_$PIECE(PRCA,"^"),"449////"_$PIECE(PRCA,"^",2),"LS")
+3 QUIT
+4 ;
+5 ;prca data ^1=ri of file 410, ^2=status code E, A, O, or C.
ERS410(PRCA) ;edit running balance status field 450, and rb quarter date field 449 if nil
+1 NEW A,B,C,D,X,Y
+2 SET A=$GET(^PRCS(410,+PRCA,0))
if A=""
QUIT
+3 SET B=""
+4 IF $PIECE(A,"^",11)=""
Begin DoDot:1
+5 SET B=$GET(^PRCS(410,+PRCA,3))
SET B=$PIECE(B,"^",11)
+6 SET B=$SELECT(B="":$PIECE(A,"-",2)_"^F",1:+$$DATE^PRC0C(B,"I"))
+7 SET C=$$QTRDT($PIECE(A,"-",1)_"^"_$PIECE(A,"-",4)_"^"_B)
+8 SET D=$$QTRDATE^PRC0D($PIECE(A,"-",2),$PIECE(A,"-",3))
SET D=$PIECE(D,"^",7)
+9 SET B=$SELECT(D<$PIECE(C,"^",3):$PIECE(C,"^",3),$PIECE(C,"^",2)<D:$PIECE(C,"^",2),1:D)
+10 SET B="449////"_B_";"
+11 QUIT
End DoDot:1
+12 IF $PIECE(PRCA,"^",2)]""
SET B=B_"450////"_$PIECE(PRCA,"^",2)
+13 IF B]""
DO EDIT^PRC0B(.X,"410;^PRCS(410,;"_$PIECE(PRCA,"^"),B,"LS")
+14 QUIT
+15 ;
+16 ;prca data ^1=station #, ^2=running balance quarter date (fileman date)
+17 ;prcb = obligation, p.o. or amendment date (fileman date)
OBDT(PRCA,PRCB) ;ef value = true if rb qtr date and obl/p.o./amend are compatible
+1 NEW A,B,C
+2 SET A=$$DATE^PRC0C(PRCB,"I")
SET A=$PIECE($$QTRDATE^PRC0D(+A,$PIECE(A,"^",2)),"^",7)
+3 SET B=$PIECE($GET(^PRC(420,+PRCA,0)),"^",9)
+4 SET C=$SELECT($PIECE(PRCA,"^",2)'>B:B,1:$PIECE(PRCA,"^",2))
+5 QUIT A=C
+6 ;
+7 ;A data ^1=station #, ^2=fiscal year, ^3=quarter year, ^4=fcp code
+8 ; ^5=BBFY
RBDT(A) ;ef=runing balance (quarter) date
+1 NEW B,C,D
+2 SET C=$$QTRDT($PIECE(A,"^",1)_"^"_$PIECE(A,"^",4)_"^"_$SELECT($PIECE(A,"^",5):$PIECE(A,"^",5),1:$PIECE(A,"^",2)_"^F"))
+3 SET D=$$QTRDATE^PRC0D($PIECE(A,"^",2),$PIECE(A,"^",3))
SET D=$PIECE(D,"^",7)
+4 SET B=$SELECT(D<$PIECE(C,"^",3):$PIECE(C,"^",3),$PIECE(C,"^",2)<D:$PIECE(C,"^",2),1:D)
+5 QUIT B