Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: FBAAVR

FBAAVR.m

Go to the documentation of this file.
  1. FBAAVR ;AISC/GRR,SAB - FINALIZE BATCH ;4/16/2012
  1. ;;3.5;FEE BASIS;**132**;JAN 30, 1995;Build 17
  1. ;;Per VHA Directive 2004-038, this routine should not be modified.
  1. S Q="",$P(Q,"=",80)="=",IOP=$S($D(ION):ION,1:"HOME") D ^%ZIS
  1. D DT^DICRW
  1. I '$D(^XUSEC("FBAAREJECT",DUZ)),'$D(^XUSEC("FBAAFINANCE")) W !!,*7,"Sorry, you must hold security key FBAAREJECT or FBAAFINANCE!" G Q
  1. ;
  1. BT ; select batch
  1. S FBINTOT=0 K QQ W !!
  1. K DIC S DIC="^FBAA(161.7,",DIC(0)="AEQ",DIC("S")="I $G(^(""ST""))=""F"""
  1. D ^DIC K DIC("S") G Q:X="^"!(X=""),BT:Y<0
  1. L +^FBAA(161.7,+Y):$G(DILOCKTM,3)
  1. I '$T W !,"Another user is editing this batch. Try again later." G Q
  1. S FBN=+Y
  1. I $G(^FBAA(161.7,FBN,"ST"))'="F" W !,$C(7),"Batch status must be CENTRAL FEE ACCEPTED!" G DONE
  1. S FZ=^FBAA(161.7,FBN,0),FBTYPE=$P(FZ,"^",3)
  1. S FBAAB=$P(FZ,"^"),FBAAON=$P(FZ,"^",2),FBAAOB=$P(FZ,"^",8)_"-"_FBAAON
  1. I FBTYPE="B9",$P(FZ,"^",15)="" S FBCNH=1
  1. S (FBRFLAG,FBAARA)=0
  1. ;
  1. ; display batch
  1. S DIC="^FBAA(161.7,",DA=FBN,DR="0:1;ST" W !! D EN^DIQ
  1. ;
  1. ; check for split invoice
  1. I FBTYPE="B3" D CHKSPLT^FBAAVR3
  1. ;
  1. BTL S B=FBN S DIR(0)="Y",DIR("A")="Want line items listed",DIR("B")="NO" D ^DIR K DIR G Q:$D(DIRUT) W:Y @IOF D:Y LIST^FBAACCB:FBTYPE="B3",LISTP^FBAACCB:FBTYPE="B5",LISTT^FBAACCB0:FBTYPE="B2",LISTC^FBAACCB1:FBTYPE="B9"
  1. ;
  1. RD0 ; local reject functionality
  1. I '$D(^XUSEC("FBAAREJECT",DUZ)) W !,"Skipping reject function because key not held." G RDD
  1. ;
  1. S DIR(0)="Y",DIR("A")="Want to reject the entire Batch",DIR("B")="NO",DIR("?")="'Yes' will flag all payment items in batch as rejected, 'No' will prompt for rejection of specific line items." D ^DIR K DIR G Q:$D(DIRUT),^FBAADD:Y
  1. ;
  1. I FBTYPE="B3",$D(FBLNLST) D G Q:$D(DIRUT),SPLIT^FBAAVR2:Y
  1. . S DIR(0)="Y"
  1. . S DIR("A")="Want to reject all line items on split invoices"
  1. . S DIR("B")="NO"
  1. . S DIR("?")="'Yes' will flag all payment items on split invoices as rejected, 'No' will prompt for rejection of specific line items."
  1. . D ^DIR K DIR
  1. ;
  1. RD1 S DIR(0)="Y",DIR("A")="Want to reject any line items",DIR("B")="NO" D ^DIR K DIR G Q:$D(DIRUT)
  1. I 'Y G RDD
  1. ; answered yes to reject line items
  1. I $P(FZ,U,11)'>0 G NOLINE^FBAADD
  1. D CK1358^FBAAUTL1 G Q:$D(FBERR)
  1. D DELC^FBAAVR0:FBTYPE="B9"
  1. D DELT^FBAAVR1:FBTYPE="B2"
  1. D DELP^FBAAVR1:FBTYPE="B5"
  1. D DELM^FBAAVR2:FBTYPE="B3"
  1. ;
  1. RD2 ; update obligation for rejected lines that are posted by batch
  1. I FBRFLAG D
  1. . N FBX
  1. . S FBRFLAG=0
  1. . Q:FBAARA'>0
  1. . S FBX=$$POSTBAT^FB1358(FBN,FBAARA,"R")
  1. . I 'FBX D
  1. . . W !,"Error posting $"_$FN(FBAARA,",",2)_" to 1358 for batch "_FBAAB
  1. . . W !," "_$P(FBX,"^",2)
  1. ;
  1. ; display batch
  1. S DIC="^FBAA(161.7,",DA=FBN,DR="0:1;ST" W !! D EN^DIQ
  1. ;
  1. RDD ; finalize batch functionality
  1. I '$D(^XUSEC("FBAAFINANCE",DUZ)) W !,"Skipping finalize function because key not held." G DONE
  1. ;
  1. ; enforce segregation of duties
  1. I $P(FZ,U,7)=DUZ W $C(7),!,"You released this batch. Per segregation of duties you cannot finalize it." G DONE
  1. ;
  1. RDD1 ; ask if batch should be finalized
  1. S DIR(0)="Y",DIR("A")="Do you want to Finalize Batch as Correct"
  1. S DIR("B")="NO"
  1. D ^DIR K DIR G Q:$D(DIRUT)
  1. I 'Y W !!,"Batch has NOT been Finalized!",$C(7) G DONE
  1. ;
  1. ; generate voucher batch message
  1. S FBX=$$VBMSG^FBAAVR5(FBN)
  1. I FBX W !,"Voucher Batch message # "_FBX_" sent to Central Fee."
  1. I 'FBX D G DONE
  1. . W !,"Error occurred during creation of voucher batch message."
  1. . W !," ",$P(FBX,U,2)
  1. . W !!,"Batch has NOT been Finalized!",$C(7)
  1. ;
  1. ; finalize batch
  1. ; update line items
  1. D MEDV:FBTYPE="B3",VCHNH^FBAAVR0:FBTYPE="B9"
  1. ; update batch file
  1. S DA=FBN,DIE="^FBAA(161.7,"
  1. S DR="13////^S X=DT;14////^S X=DUZ;11////^S X=""V"";20////^S X=1"
  1. D ^DIE K DIE,DA
  1. W !!," Batch has been Finalized!"
  1. ;
  1. DONE ;
  1. D Q
  1. G FBAAVR
  1. ;
  1. Q ; clean-up
  1. I $G(FBN) L -^FBAA(161.7,FBN)
  1. K B,J,K,L,M,X,Y,Z,DIC,ERR,FBN,FBAAOUT,FBAC,FBAP,FBFD,FBPDT,FBSC,FBTD,FBVP,POP,FBRFLAG,Q,QQ,A,A1,A2,DO,DA,DL,DR,DRX,DX,FBAAAP,FBAACB,FBAACPT,FBAAON,FBAARA,FBINTOT,FBIN,FBRR,FBTYPE,FZ,HX,I,P3,P4,S,V,VAL,VID,XY,ZS,FBAAB,FBAAOB,DIRUT
  1. K FBAAON,FBCOMM,FBERR,FBI,FBLIST,PRCS("TYPE"),FBLISTC,FBINOLD,FBDX,FBK,FBL,FBPROC,FBCNH,FBAAMT,FBII78,FBLNLST
  1. Q
  1. ;
  1. MEDV ; set DATE FINALIZED for line items in batch type B3
  1. F J=0:0 S J=$O(^FBAAC("AC",B,J)) Q:J'>0 F K=0:0 S K=$O(^FBAAC("AC",B,J,K)) Q:K'>0 F L=0:0 S L=$O(^FBAAC("AC",B,J,K,L)) Q:L'>0 F M=0:0 S M=$O(^FBAAC("AC",B,J,K,L,M)) Q:M'>0 D SETXFR
  1. Q
  1. SETXFR I '$D(^FBAAC(J,1,K,1,L,1,M,"FBREJ")),$D(^FBAAC(J,1,K,1,L,1,M,0)) S DA(3)=J,DA(2)=K,DA(1)=L,DA=M,DIE="^FBAAC(DA(3),1,DA(2),1,DA(1),1,",DR="5///^S X=DT" D ^DIE K DIE,DA,DR
  1. Q
  1. ;
  1. ;FBAAVR