source: WorldVistAEHR/trunk/r/FEE_BASIS-FB/FBAAPIP.m@ 792

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

initial load of WorldVistAEHR

File size: 3.0 KB
Line 
1FBAAPIP ;AISC/GRR-ESTABLISH BATCH FOR INVOICE AND CLOSE-OUT ;28MAR86
2 ;;3.5;FEE BASIS;;JAN 30, 1995
3 ;;Per VHA Directive 10-93-142, this routine should not be modified.
4 D DT^DICRW S FBSW=1
5RD1 W !! S DIC="^FBAA(162.1,",DIC(0)="AEQM",DIC("S")="I $P(^(0),U,5)=3" D ^DIC K DIC G Q:X="^"!(X=""),RD1:Y<0 S (DA,IN,FBIN)=+Y,FBINTOT=0 D CALC^FBAAPIE1,WRT,EN1 G RD1
6EN1 ;ENTRY FROM THE MAS CLOSE-OUT OPTION (FBAACIE)
7 S FY=$E(DT,1,3)+1700+$S($E(DT,4,5)>9:1,1:0)
8 S FBAAMPI=$S($D(^FBAA(161.4,1,"FBNUM")):$P(^("FBNUM"),"^",3),1:100),FBAAMPI=$S(FBAAMPI]"":FBAAMPI,1:100),FBSW=1
9 D BT Q:'$D(FBBN) D WAIT^DICD S (TIC,TAC,TAP,FBSW,FBAATPV)=0 D GO Q
10BT W !! S DIC="^FBAA(161.7,",DIC(0)="AEQM",DIC("A")="Select Batch for this Invoice: ",DIC("S")="I $P(^(0),U,3)=""B5""&($G(^(""ST""))=""O"")"
11 S DIC("W")="W !,"" Obligation #: "",$P(^(0),U,2)" D ^DIC K DIC G Q:X="^"!(X=""),BT:Y<0 S (DA,FBBN)=+Y
12 I $P(Y,"^",3)'=1 G NOTYOU:$P(^FBAA(161.7,DA,0),"^",5)'=DUZ,NOTPH:$P(^(0),"^",3)'="B5",NOTOP:$P(^("ST"),"^",1)'="O"
13 S Z(0)=^FBAA(161.7,DA,0),FBAABO=$P(Z(0),"^",2),FBBTA=$P(Z(0),"^",9),FBBIC=$P(Z(0),"^",10)+1,FBBLC=$P(Z(0),"^",11)
14 G:FBBLC>(FBAAMPI-1) WARN
15 Q
16GO S FBAAVIN=$P(^FBAA(162.1,FBIN,0),"^",4) F FBJ=0:0 S FBJ=$O(^FBAA(162.1,FBIN,"RX",FBJ)) Q:FBJ'>0 S Y(0)=^FBAA(162.1,FBIN,"RX",FBJ,0) D:$P(Y(0),"^",16)>0 GOT
17 D RSET W !!,"Invoice Closed out!!" S FBSW=1
18Q Q:'FBSW K J,FBAABO,FBBN,FBIN,TAC,TAP,TIC,DIC,D0,DA,DI,DIE,DQ,DR,IN,FBINTOT,FBAAMPI,FBAATPV,FBAAVIN,FBBIC,FBBLC,FBBTA,FBJ,FY,FBZZ,X,Y,Z,FBSTN Q
19GOT S TAC=TAC+$P(Y(0),"^",4),TAP=TAP+$P(Y(0),"^",16),TIC=TIC+1,FBBLC=FBBLC+1,FBSW=0 I $P(Y(0),"^",20)'="R" S FBAATPV=FBAATPV+$P(Y(0),"^",16)
20 S DIC="^FBAA(162.1,"_FBIN_",""RX"",",DA=FBJ,DA(1)=FBIN,DIE=DIC,DR="13////^S X=FBBN;14////^S X=FBAABO;15////^S X=DT;8////^S X=4"
21 D ^DIE
22 I FBBLC>(FBAAMPI-1) D FULL
23 Q
24RSET S DIC="^FBAA(162.1,",DA=FBIN,DIE=DIC,DR="5////^S X=4;6///^S X=TAC;7///^S X=TAP;8///^S X=TIC" D ^DIE
25RSET2 S FBBTA=FBBTA+TAP,$P(Z(0),"^",9)=FBBTA,$P(Z(0),"^",10)=FBBIC,$P(Z(0),"^",11)=FBBLC,^FBAA(161.7,FBBN,0)=Z(0)
26 Q
27NOTYOU W !!,*7,"Batch selected established by another user, choose another." G BT
28NOTPH W !!,*7,"Batch selected is NOT a Pharmacy type batch, choose another." G BT
29NOTOP W !!,*7,"Batch selected not in Open status, choose another." G BT
30FULL D RSET2 W !!,*7,"Batch has reached maximum allowable payment entries!",!,"Now openning another batch for you.",! K FBBN
31 D NEWBT G BT:'$D(FBBN)
32 Q
33WARN W !!,*7,"That Batch already has maximum allowable payment items!" K FBBN G BT
34OUT Q
35WRT W !,?20,"Invoice Totals: $ "_$J(FBINTOT,1,2) Q
36NEWBT ;OPEN NEW BATCH IF NEEDED TO CLOSEOUT INVOICE
37 S FBSTN=$P(Z(0),"^",8),FBAAOB=$P(Z(0),"^",2) W ! D GETNXB^FBAAUTL W !!,*7,"New Batch to closeout invoice is: ",FBBN
38 S DIC="^FBAA(161.7,",DLAYGO=161.7,X=FBBN,DIC(0)="LQ",DIC("DR")="1////^S X=FBAAOB;2////^S X=""B5"";3////^S X=DT;4////^S X=DUZ;11////^S X=""O"";16////^S X=FBSTN"
39 K DD,DO D FILE^DICN K DLAYGO S FBBN=+Y,Z(0)=^FBAA(161.7,FBBN,0)
40 S FBAAOB=$P(Z(0),"^",2),FBBTA=$P(Z(0),"^",9),FBBIC=$P(Z(0),"^",10)+1,FBBLC=$P(Z(0),"^",11)
41 Q
Note: See TracBrowser for help on using the repository browser.