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

FBAAIAQ.m

Go to the documentation of this file.
  1. FBAAIAQ ;ALB/FA - Managing IPAC Agreement MRAs ;04 Dec 2013 7:36 AM
  1. ;;3.5;FEE BASIS;**123**;JAN 30, 1995;Build 51
  1. ;;Per VA Directive 6402, this routine should not be modified.
  1. ;
  1. ; Contains methods for creating add/edit/delete Master Record Adjustments for a
  1. ; selected IPAC Vendor Agreement
  1. ;
  1. ;-----------------------------------------------------------------------------
  1. ; Entry Points
  1. ; A - Create an Add Master Record Adjustment for a newly created IPAC
  1. ; Vendor Agreement
  1. ; AA - Create an Add Master Record Adjustment for a specified IPAC Vendor
  1. ; Agreement without changing existing data. Called from
  1. ; FBAA IPAC AGREEMENT MRA MENU/FBAA MRA IPAC ADD TYPE
  1. ; C - Create an Edit Master Record Adjustment for an edited IPAC Vendor
  1. ; agreement
  1. ; CC - Create an Edit Master Record Adjustment for a specified Vendor
  1. ; Agreement without changing existing data. Called from
  1. ; FBAA IPAC AGREEMENT MRA MENU/FBAA MRA IPAC CHANGE TYPE
  1. ; D - Create a Delete Master Record Adjustment record
  1. ; DD - Create a delete Master Record Adjustment record for a specified
  1. ; Vendor Agreement without changing existing data. Called from
  1. ; FBAA IPAC AGREEMENT MRA MENU/FBAA MRA IPAC DELETE TYPE
  1. ;-----------------------------------------------------------------------------
  1. ;
  1. A(VAIEN) ;EP
  1. ; Create an IPAC Vendor Agreement Add MRA record. Only called when adding
  1. ; a new Vendor agreement
  1. ; Input: VAIEN - Vendor Agreement IEN to create an ADD MRA
  1. ; record for
  1. ; Output:
  1. ; Called From: FBAAIAE@ADDVA
  1. N VAID
  1. S VAID=$P(^FBAA(161.95,VAIEN,0),U,1)
  1. D NEWMRA(VAIEN,VAID,"A")
  1. Q
  1. ;
  1. C(VAIEN) ;EP
  1. ; Create a Change MRA record for the edited Vendor Agreement
  1. ; Input: VAIEN - Vendor Agreement IEN
  1. ; ^TMP($J,"FBAAIAC") - Vendor Agreement values prior to being
  1. ; being edited. Used to detect changes.
  1. ; Called From: FBAAIAC@EDITF
  1. N MRAACT,VAID
  1. S VAID=$P(^FBAA(161.95,VAIEN,0),U,1)
  1. ;
  1. ; If a pending MRA record already exists for this agreement quit now
  1. Q:$$PENDMRA(VAID,.MRAACT)
  1. D NEWMRA(VAIEN,VAID,"C")
  1. Q
  1. ;
  1. D(VAID) ;EP
  1. ; Create a Delete MRA record for the selected Vendor Agreement
  1. ; Input: VAID - ID of the Selected Vendor Agreement
  1. ; Output: Delete Master Record Adjustment record created (potentially)
  1. ; Called From: DEL@FBAAIAD
  1. N MRAACT,MRAIEN
  1. S MRAIEN=$$PENDMRA(VAID,.MRAACT)
  1. ;
  1. ; If a pending MRA record for the Vendor agreement exists, it must be either an
  1. ; ADD or a CHANGE record. It cannot be a DELETE record because before a DELETE
  1. ; MRA record is filed for a Vendor agreement, the agreement is deleted from the
  1. ; file making it impossible to be deleted again. If a pending MRA record is an
  1. ; ADD action we just need to delete it because the user deleted the Vendor
  1. ; agreement before it was ever transmitted. If it is a CHANGE action we need to
  1. ; edit it and change the action to DELETE and re-file it rather than file a new one.
  1. I MRAIEN>0 D Q
  1. . I MRAACT="A" D DELMRA(MRAIEN) Q
  1. . N DA,DIE,DR,DTOUT
  1. . S DIE=161.96,DA=MRAIEN
  1. . S DR="1////@;3////D"
  1. . D ^DIE
  1. D NEWMRA("",VAID,"D") ; Create a DELETE MRA record
  1. Q
  1. ;
  1. PENDMRA(VAID,MRASTAT) ; Checks to see if an MRA record in a pending status already
  1. ; exists for the specified IPAC Vendor Agreement
  1. ; Input: VAID - ID of the selected IPAC Vendor Agreement
  1. ; Output: MRAACT - Action of the pending MRA record
  1. ; "" if no pending MRA record exists
  1. ; Returns: IEN of the pending MRA record if one exists, 0 otherwise
  1. ; Called From: AA,C,CC,D
  1. N MRAIEN,STOP
  1. S MRASTAT="",MRAIEN="",STOP=0
  1. F D Q:MRAIEN="" Q:STOP
  1. . S MRAIEN=$O(^FBAA(161.96,"AS","P",MRAIEN))
  1. . Q:MRAIEN=""
  1. . ;
  1. . ; Quit if the MRA is not for the selected Vendor Agreement
  1. . Q:$P(^FBAA(161.96,MRAIEN,0),U,3)'=VAID
  1. . S STOP=1
  1. S:STOP MRASTAT=$P(^FBAA(161.96,MRAIEN,0),U,4)
  1. Q:STOP MRAIEN
  1. Q 0
  1. ;
  1. AA ;EP
  1. ; Create and ADD Master Record Adjustment for a specified Vendor Agreement without
  1. ; changing existing data
  1. ; Input: None
  1. ; Called From: Menu - FBAA IPAC AGREEMENT MRA MENU/FBAA MRA IPAC ADD TYPE
  1. N DIC,DTOUT,DUOUT,MRAACT,MRAIEN,MRASTAT,VAID,VAIEN,X,Y
  1. S DIC=161.95,DIC(0)="AEQMZ"
  1. S DIC("A")="Select an IPAC Vendor Agreement: "
  1. D ^DIC ; Select an agreement
  1. Q:Y'>0
  1. S VAIEN=+Y ; Selected Vendor Agreement EIN
  1. Q:VAIEN'>0 ; No selected agreement
  1. I $P(^FBAA(161.95,VAIEN,0),U,4)="N" D Q
  1. . W !!,"IPAC Vendor Agreement Status is NEW."
  1. . W !,"First edit the Vendor Agreement and complete it."
  1. S VAID=$P(^FBAA(161.95,VAIEN,0),U,1)
  1. ;
  1. ; Check to see if the selected Vendor Agreement already has a pending MRA record
  1. S MRAIEN=$$PENDMRA(VAID,.MRAACT)
  1. ;
  1. ; No pending record exists, attempt to add a pending MRA add record for the selected
  1. ; Vendor agreement
  1. I MRAIEN=0 D Q
  1. . I '$$LOCKVA^FBAAIAU(VAIEN,0) D Q
  1. . . W !!,"Someone else is editing this agreement. "
  1. . . W !,"An ADD MRA cannot be created at this time."
  1. . . W !,"Try again later."
  1. . D NEWMRA(VAIEN,VAID,"A")
  1. . D UNLOCKVA^FBAAIAU(VAIEN)
  1. . W !!,"ADD MRA created and ready for transmission.",!!
  1. ;
  1. S MRASTAT=$P(^FBAA(161.96,MRAIEN,0),U,5)
  1. I MRASTAT="P",MRAACT="A" W !!,"ADD MRA already exists." Q
  1. ;
  1. ; Prompt the user to ask if we should change a pending CHANGE MRA record to a
  1. ; pending Add MRA record
  1. I MRASTAT="P",MRAACT="C" D
  1. . I '$$LOCKVA^FBAAIAU(VAIEN,0) D Q
  1. . . W !!,"Someone else is editing this agreement. "
  1. . . W !,"An ADD MRA cannot be created at this time."
  1. . . W !,"Try again later."
  1. . W !,"An MRA is with a status of CHANGE is currently Pending."
  1. . N DA,DIE,DIR,DIROUT,DIRUT,DR,DTOUT,DUOUT,Y
  1. . S DIR(0)="Y",DIR("A")="Do you want to change the type to ADD?"
  1. . S DIR("B")="No"
  1. . D ^DIR
  1. . I +Y=0 D UNLOCKVA^FBAAIAU(VAIEN) Q
  1. . S DIE=161.96,DA=MRAIEN
  1. . S DR="3////A;4////P"
  1. . D ^DIE
  1. . D UNLOCKVA^FBAAIAU(VAIEN)
  1. . W !!,"ADD MRA created from a CHANGE MRA and ready for transmission.",!!
  1. Q
  1. ;
  1. CC ;EP
  1. ; Change a Master Record Adjustment for a specified Vendor agreement without
  1. ; changing existing data
  1. ; Input: None
  1. ; Called From: Menu - FBAA IPAC AGREEMENT MRA MENU/FBAA MRA IPAC CHANGE TYPE
  1. N DIC,DTOUT,DUOUT,MRAACT,MRAIEN,MRASTAT,VAID,VAIEN,X,Y
  1. S DIC=161.95,DIC(0)="AEQMZ"
  1. S DIC("A")="Select an IPAC Vendor Agreement: "
  1. D ^DIC ; Select an agreement
  1. Q:Y'>0
  1. S VAIEN=+Y ; Selected Vendor Agreement EIN
  1. Q:VAIEN'>0 ; No selected agreement
  1. ;
  1. I $P(^FBAA(161.95,VAIEN,0),U,4)="N" D Q
  1. . W !!,"IPAC Vendor Agreement Status is NEW."
  1. . W !,"First edit the Vendor Agreement and complete it."
  1. S VAID=$P(^FBAA(161.95,VAIEN,0),U,1)
  1. ;
  1. ; Check to see if the selected Vendor Agreement already has a pending MRA record
  1. S MRAIEN=$$PENDMRA(VAID,.MRAACT)
  1. ;
  1. ; No pending record exists, attempt to add a pending MRA change record for the selected
  1. ; Vendor agreement
  1. I MRAIEN=0 D Q
  1. . I '$$LOCKVA^FBAAIAU(VAIEN,0) D Q
  1. . . W !!,"Someone else is editing this agreement. "
  1. . . W !,"A CHANGE MRA cannot be created at this time."
  1. . . W !,"Try again later."
  1. . D NEWMRA(VAIEN,VAID,"C")
  1. . D UNLOCKVA^FBAAIAU(VAIEN)
  1. . W !!,"CHANGE MRA created and ready for transmission.",!!
  1. ;
  1. S MRASTAT=$P(^FBAA(161.96,MRAIEN,0),U,5)
  1. I MRASTAT="P",MRAACT="C" W !!,"CHANGE MRA already exists." Q
  1. ;
  1. ; Prompt the user to ask if we should change a pending Add MRA record to a
  1. ; pending Add MRA record
  1. I MRASTAT="P",MRAACT="A" D
  1. . I '$$LOCKVA^FBAAIAU(VAIEN,0) D Q
  1. . . W !!,"Someone else is editing this agreement. "
  1. . . W !,"A CHANGE MRA cannot be created at this time."
  1. . . W !,"Try again later."
  1. . W !,"An MRA is with a status of ADD is currently Pending."
  1. . N DA,DIE,DIR,DIROUT,DIRUT,DR,DTOUT,DUOUT,Y
  1. . S DIR(0)="Y",DIR("A")="Do you want to change the type to CHANGE?"
  1. . S DIR("B")="No"
  1. . D ^DIR
  1. . I +Y=0 D UNLOCKVA^FBAAIAU(VAIEN) Q
  1. . S DIE=161.96,DA=MRAIEN
  1. . S DR="3////C;4///P"
  1. . D ^DIE
  1. . D UNLOCKVA^FBAAIAU(VAIEN)
  1. . W !!,"CHANGE MRA created from an ADD MRA and ready for transmission.",!!
  1. Q
  1. ;
  1. DD ;EP
  1. ; Create a delete Master Record Adjustment record for a specified Vendor Agreement
  1. ; without changing actual data
  1. ; Called From: Menu - FBAA IPAC AGREEMENT MRA MENU/FBAA MRA IPAC DELETE TYPE
  1. N DA,DIE,DR,DIR,FLINE,STEXT,MRAIEN,X,Y
  1. S FLINE="The following Transmitted DELETE MRA Records are currently on file:"
  1. S STEXT="Please select the DELETE MRA Record to re-transmit"
  1. ;
  1. ; Display a list of Transmitted Deleted MRA Records for selection
  1. S MRAIEN=$$SELMRA^FBAAIAU(FLINE,STEXT,"T","D")
  1. Q:MRAIEN="" ; No MRA record selected
  1. ;
  1. ; Change the status and remove the transmit date of the selected transmitted
  1. ; record and refile it.
  1. S DIE="^FBAA(161.96,",DA=MRAIEN
  1. S DR="3///^S X="_"""DELETE"""
  1. S DR=DR_";4////P;5////@"
  1. D ^DIE
  1. W !!,"DELETE MRA processing completed."
  1. Q
  1. ;
  1. NEWMRA(VAIEN,VAID,ACTION) ; Create an IPAC Vendor Agreement MRA record of
  1. ; specified ACTION for the specified Vendor Agreement
  1. ; a new Vendor agreement
  1. ; Input: VAIEN - Vendor Agreement IEN to create an MRA
  1. ; record for. "" if creating a DELETE MRA
  1. ; VAID - Vendor Agreement ID to create and MRA record for
  1. ; ACTION - MRA Action ('A','C' or 'D')
  1. ; Output: New MRA record is filed
  1. ; Called From: A,AA,C,CC,D,DD
  1. N DA,DIC,DO,DR,DTOUT,DUOUT,X,Y
  1. S DIC=161.96,DIC(0)="EZ"
  1. S X=$P($G(^FBAA(161.96,0)),U,4)+1
  1. S DIC("DR")="1///^S X=VAIEN;2///^S X=VAID;3///^S X=ACTION;4///P"
  1. D FILE^DICN
  1. Q
  1. ;
  1. DELMRA(MRAIEN) ; Delete an existing MRA record
  1. ; Input: MRAIEN - IEN of the MRA record to be deleted
  1. ; Output: Specified MRA record is deleted
  1. ; Called From: A,C,D
  1. N DA,DIK
  1. S DIK="^FBAA(161.96,"
  1. S DA=MRAIEN
  1. D ^DIK
  1. Q
  1. ;