source: WorldVistAEHR/trunk/r/IFCAP-PRC-PRX--PRCA--PRCN/PRCECAL.m@ 619

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

initial load of WorldVistAEHR

File size: 3.4 KB
Line 
1PRCECAL ;WISC/LDB/BGJ-RECALCULATE AUTHORIZATION BALANCES ; 03 Feb 93 10:29 AM
2V ;;5.1;IFCAP;;Oct 20, 2000
3 ;Per VHA Directive 10-93-142, this routine should not be modified.
4FISCAL ;Entry point for any obligation's authorizations
5 D EXIT S PRCF("X")="AS" D ^PRCFSITE
6 I '$D(PRC("SITE")) D EXIT Q
7 D OBLK^PRCH58OB(.PODA)
8 I '$G(PODA) D EXIT Q
9 I (+PODA(1)'=PRC("SITE")) D EXIT Q
10 G:'$P(PODA(0),U,12) EXIT S PO=$P(PODA(0),U,12) D NODE^PRCS58OB(PO,.TRNODE) G:$P($G(TRNODE(0)),U,4)'=1 EXIT S PO=PODA(1)
11 Q:'$D(^PRC(424,"AF",PO))
12 D RECALC
13 Q
14 ;
15FCP ;Entry point for Fund Control Point for obligations within the FCP
16 D EXIT,EN3^PRCSUT I '$D(PRC("CP"))!'$D(PRC("SITE")) D EXIT Q
17 D OBLK^PRCH58OB(.PODA)
18 I '$G(PODA) D EXIT Q
19 I (+PODA(0)'=PRC("SITE"))!(+PODA(2)'=+PRC("CP"))!('$P(PODA(0),U,12)) D EXIT Q
20 S PO=$P(PODA(0),U,12) D NODE^PRCS58OB(PO,.TRNODE)
21 S PO=PODA(1) I '$D(^PRC(424,"AF",PO)) D EXIT Q
22 ;
23RECALC ;Recalculate totals in file 424
24 ;Update obligation estimated balance
25 S AUDA="",FCPAMT=0 F S AUDA=$O(^PRC(424,"AF",PO,AUDA)) Q:'AUDA I $D(^PRC(424,AUDA,0)) S (AUAMT,AUBAL)=0 D
26 .S FCPAMT=$P(^PRC(424,AUDA,0),U,6)+FCPAMT
27 D BALOB^PRCH58(PODA,FCPAMT)
28 ;Update obligation Fiscal liquidation balance
29 S AUDA="",LQAMT=0 F S AUDA=$O(^PRC(424,"AG",PO,AUDA)) Q:'AUDA I $D(^PRC(424,AUDA,0)) D
30 .S LQAMT=$P(^PRC(424,AUDA,0),U,4)+LQAMT
31 D BAL1^PRCH58OB(PODA,LQAMT)
32 ;S AMT=+$G(BAL)-LQAMT D BAL1^PRCH58OB(PODA,AMT)
33 ;Update authorizations balances
34 S (DRAMT,AUDA,DRAUMT)=0 F S AUDA=$O(^PRC(424,"AD",PO,AUDA)) Q:'AUDA I $D(^PRC(424,AUDA,0)),$P(^(0),U,3)="AU" S DRAUMT=$P(^(0),U,12) D
35 . S (DRPAMT,DA)=0 F S DA=$O(^PRC(424.1,"C",AUDA,DA)) Q:'DA I $D(^PRC(424.1,DA,0)) D
36 ..S:$P(^PRC(424.1,DA,0),U,11)="P" DRPAMT=$P(^PRC(424.1,DA,0),U,3)+DRPAMT ;S:$P(^(0),U,11)["A" DRAUMT=DRAUMT+$P(^(0),U,3)
37 . S $P(^PRC(424,AUDA,0),U,12)=$S((+$G(DRAUMT)'<0):DRAUMT,(+$G(DRAMT)'<0):DRAMT,1:+$P($G(^PRC(424,AUDA,0)),U,13))
38 . S $P(^PRC(424,AUDA,0),U,5)=$P(^PRC(424,AUDA,0),U,12)+$G(DRPAMT),AUAMT(AUDA)=$P(^(0),U)_"^"_$P(^(0),U,12)_"^"_$P(^(0),U,5)_"^"_-DRPAMT,AUAMT=AUAMT+DRAMT,AUBAL=AUBAL+$P(^(0),U,5)
39 ;Update obligation balance
40 S (AMT,AUDA)=0 F S AUDA=$O(^PRC(424,"AD",PO,AUDA)) Q:'AUDA I $D(^PRC(424,AUDA,0)) D
41 . S AMT=$P(^(0),U,12)+AMT
42 ;Print obligation, liquidation and authorization balances
43 S BAL1=AMT D BALAU^PRCH58(PODA,BAL1)
44 S BAL=$$BAL^PRCH58(PODA)
45 W @IOF,!,?25,PO," ","OBLIGATION BALANCES"
46 W !!," OBLIGATION AMOUNT: $",$$LBF1^PRCFU($FN(+BAL,",P",2),14)
47 W ?37," SERVICE BALANCE: $",$$LBF1^PRCFU($FN(+BAL-$P(BAL,U,3),",P",2),14)
48 W !,"LIQUIDATION BALANCE: $",$$LBF1^PRCFU($FN($P(BAL,U)-$P(BAL,U,2),",P",2),14)
49 W ?37,"TOTAL LIQUIDATIONS: $",$$LBF1^PRCFU($FN($P(BAL,U,2),",P",2),14)
50 W !!,"AUTHORIZATION BALANCE(S): " S AUDA=0
51 W !!,"AUTHORIZATION #",?21,"AMOUNT",?37,"BALANCE",?54,"PAYMENT"
52 F S AUDA=$O(AUAMT(AUDA)) Q:'AUDA D Q:X="^"
53 .S DIR(0)="E" I ((IOSL-$Y)<4) D ^DIR Q:X="^" W @IOF
54 .W !,$P(AUAMT(AUDA),U)
55 .W ?17,"$",$$LBF1^PRCFU($FN($P(AUAMT(AUDA),U,2),",P",2),14)
56 .W ?34,"$",$$LBF1^PRCFU($FN($P(AUAMT(AUDA),U,3),",P",2),14)
57 .W ?51,"$",$$LBF1^PRCFU($FN($P(AUAMT(AUDA),U,4),",P",2),14)
58 G:X="^" EXIT I $Y+4>IOSL D ^DIR Q:X="^" W @IOF
59 W !,?17,"______________",?34,"______________",?51,"______________" W !?17,"$",$$LBF1^PRCFU($FN(AMT,",P",2),14),?34,"$",$$LBF1^PRCFU($FN(AUBAL,",P",2),14),?51,"$",$$LBF1^PRCFU($FN(AMT-AUBAL,",P",2),14)
60EXIT K AMT,AUAMT,AUBAL,AUDA,BAL,BAL1,DA,DIC,DIR,DRAMT,DRAUMT,FCPAMT,LQAMT,PO,PODA,PRC,PRCF,X,Y,TRNODE,PRCF
61 Q
Note: See TracBrowser for help on using the repository browser.