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

BARMAWO3.m

Go to the documentation of this file.
  1. BARMAWO3 ; IHS/SD/LSL - Automatic Write-Off UFMS NON-BEN IN ERROR 2007 - Reversal ;
  1. ;;1.8;IHS ACCOUNTS RECEIVABLE;**2,28**;OCT 26, 2005;Build 92
  1. ;
  1. ; THIS IS TO BE USE ONLY TO REVERSE THE WRITE OFFS ON NON-BEN ACCOUNTS
  1. ; WHEN PATCH 1 OF THE UFMS WRITE-OFF 2007 WERE MSITAKENLY MADE BECAUSE
  1. ; THE OLD CODE WAS USING THE 'STANDS FOR' AND NOT THE CODE FOR VP INSURER TYPE
  1. ; THE STRING HAD BEEN CHANGED BY THE AUPN DEVELOPER AND WAS NOT PUBLICIZED.
  1. ;
  1. ; THIS ROUTINE WAS COPIED AND MODIFIED FROM BARMAWO2
  1. ; *********************************************************************
  1. ;STOP!!! STOP!!!! STOP!!!!
  1. ;IHS/SD/SDR 1.8*28 HEAT293633 - This is an old, outdated routine and shouldn't be used
  1. ; without review and possible changes. Routine EN^BARMAWO6 should be used instead. A
  1. ; quit has been added to this routine so it can't be accidentally run.
  1. ; *********************************************************************
  1. Q
  1. ;
  1. EN ; EP - IHS/DIT/CPC 1.8*28 CR 8349 START
  1. W "*********************************************************************",!
  1. W " STOP!!! STOP!!!! STOP!!!!",!
  1. W "This is an old, outdated routine and shouldn't be used. Please ",!
  1. W "request assistance from OIT before starting the write-off process.",!
  1. W "*********************************************************************",!
  1. H 10
  1. Q ;IHS/DIT/CPC 1.8*28 CR 8349 STOP
  1. D NOTE
  1. Q:'BARCONT
  1. D NOW^%DTC
  1. S BARNOW=%
  1. D LOOP
  1. W !!!,BARCNT," Bills with AUTO WRITE-OFF 2007 (916) reversed."
  1. D XIT
  1. Q
  1. ; *********************************************************************
  1. ;
  1. NOTE ;
  1. S BARCONT=0
  1. W !!,$$EN^BARVDF("RVN"),"NOTE:",$$EN^BARVDF("RVF")
  1. W ?7,"All transactions (at all facilities) of transaction type 43 (Adjustment)"
  1. W !?7,"with Adjustment Category 3 (Write Off)"
  1. W !?7,"and Adjustment Type 916 (AUTO WRITE-OFF 2007)"
  1. W !?7,"will be reversed by creating a new transaction of the same type,"
  1. W !?7,"but negative dollar amount. Only the Non-Ben entries mistakenly written"
  1. W !?7,"off during the UFMS AUTO WRITE-OFF of 2007 in Patch 1 will be reversed"
  1. W !!?7,$$EN^BARVDF("RVN"),"ALSO,",$$EN^BARVDF("RVF")," the bill will be re-opened in 3PB with a balance due."
  1. ;
  1. D CHECK ; See if this has been run before
  1. Q:BARDONE
  1. ;
  1. W !!,"The bill number and amount written off will scroll by on the screen"
  1. W !,"if you wish to capture this information.",!
  1. ;
  1. K DIR
  1. S DIR(0)="Y"
  1. S DIR("A")="Continue"
  1. S DIR("B")="No"
  1. D ^DIR
  1. K DIR
  1. S:Y=1 BARCONT=1
  1. Q
  1. ; *********************************************************************
  1. ;
  1. CHECK ;
  1. ; Check to see if this option has already been run
  1. S BARDONE=0
  1. I $D(^BARTMP("AWO-NON-BEN-REVERSE")) D Q
  1. . S Y=^BARTMP("AWO-NON-BEN-REVERSE")
  1. . D DD^%DT
  1. . S BARDONDT=Y
  1. . S BARDONE=1
  1. . S $P(BARDASH,"*",54)=""
  1. . W !!?14,BARDASH
  1. . W !?14,"* This option was already executed on ",BARDONDT,". *"
  1. . W !?14,"*",?24,"It may not be executed again.",?66,"*"
  1. . W !?14,BARDASH
  1. . D EOP^BARUTL(0)
  1. Q
  1. ; *********************************************************************
  1. ;
  1. LOOP ;
  1. ; Loop all DUZ(2) in transaction file.
  1. S ^BARTMP("AWO-NON-BEN-REVERSE")=DT
  1. S BARCNT=0
  1. S BARHOLD=DUZ(2)
  1. S DUZ(2)=0
  1. F S DUZ(2)=$O(^BARTR(DUZ(2))) Q:'+DUZ(2) D TRANS
  1. S DUZ(2)=BARHOLD
  1. Q
  1. ; *********************************************************************
  1. ;
  1. TRANS ;
  1. ; Loop transactions after APR 12,2007 @ 7:00 for each DUZ(2)
  1. ; APR 12,2007 @ 7:00 used because this is just before the release (4/13)
  1. ; of UFMS AWO coding. Code 916 did not exist before then.
  1. S BARDTTR=3070412.07
  1. F S BARDTTR=$O(^BARTR(DUZ(2),BARDTTR)) Q:('+BARDTTR!(BARDTTR>BARNOW)) D ISITAWO
  1. Q
  1. ; *********************************************************************
  1. ;
  1. ISITAWO ;
  1. ; Check to see if trans is AUTO WRITE-OFF 2007
  1. S BARTR(0)=$G(^BARTR(DUZ(2),BARDTTR,0)) ; A/R Transaction 0 node
  1. S BARTR(1)=$G(^BARTR(DUZ(2),BARDTTR,1)) ; A/R Transaction 1 node
  1. ;BAR*1.8*2
  1. S BARBL=$P(BARTR(0),U,4) ;BILL IEN
  1. Q:BARBL=""
  1. S POSTTRAN=$O(^BARTR(DUZ(2),"AC",BARBL,BARDTTR)) ;GET NEXT TRANSACTION
  1. I POSTTRAN'="" D
  1. .S POSTAWO=$$GET1^DIQ(90050.03,POSTTRAN_",",103,"I")
  1. .S POSTDEB=$$GET1^DIQ(90050.03,POSTTRAN_",",3,"I") ;GET DEBIT OF NEXT TRANS
  1. S PRETRAN=$O(^BARTR(DUZ(2),"AC",BARBL,BARDTTR),-1) ;GET NEXT TRANSACTION
  1. I PRETRAN'="" D
  1. .S PREAWO=$$GET1^DIQ(90050.03,PRETRAN_",",103,"I")
  1. .S PRECRED=$$GET1^DIQ(90050.03,PRETRAN_",",2,"I") ;GET DEBIT OF PREVIOUS TRANS
  1. ;GET ADJUSTMENT TYPE
  1. ;
  1. ;this is only for those non-ben accounts that were accidently written off
  1. S BARACT=$P(BARTR(0),U,6)
  1. Q:BARACT=""
  1. S D0=BARACT ;BAR*1.8*2
  1. S BARITYP=$$VALI^BARVPM(8) ;GET INTERNAL CODE INSTEAD OF 'STANDS FOR'
  1. Q:BARITYP'="N" ;NON-BEN CODE
  1. K D0
  1. ;end new code
  1. ;;ADJUST ACCOUNT - WRITE-OFF - AUTO WRITE-OFF 2007
  1. I $P(BARTR(1),U)=43,($P(BARTR(1),U,2)=3),($P(BARTR(1),U,3)=916) D
  1. . ;I POSTTRAN'="",($P(BARTR(0),U,2)=POSTDEB),(POSTAWO=916) Q ;IF THIS IS TRUE THEY MANUALLY REVER
  1. . ;I PRETRAN'="",($P(BARTR(0),U,3)=PRECRED),(PREAWO=916) Q ;IF THIS IS TRUE THEY
  1. . I POSTTRAN'="",(POSTAWO=916) Q ;IF THIS IS TRUE THEY MANUALLY REVER
  1. . I PRETRAN'="",(PREAWO=916) Q ;IF THIS IS TRUE THEY
  1. . D REVERSE
  1. . D BILLED
  1. . D ARBILL
  1. Q
  1. ARBILL ;
  1. K DIR,DIE,DR,DIC,DA,DR
  1. S DA=$P(BARTR(0),U,4)
  1. S DIE="^BARBL(DUZ(2),"
  1. S DR="15///^S X=$P(BARTR(0),U,2)"
  1. D ^DIE
  1. Q
  1. ; *********************************************************************
  1. REVERSE ;
  1. S BARTRIEN=$$NEW^BARTR ; Create new transaction
  1. S DA=BARTRIEN
  1. S DIE=90050.03
  1. S DR="3////^S X=$P(BARTR(0),U,2)" ; PUT WRITE-OFF AMT IN DEBIT ($$$)
  1. S DR=DR_";4////^S X=$P(BARTR(0),U,4)" ; A/R Bill
  1. S DR=DR_";5////^S X=$P(BARTR(0),U,5)" ; A/R Patient
  1. S DR=DR_";6////^S X=$P(BARTR(0),U,6)" ; A/R Account
  1. S DR=DR_";8////^S X=$P(BARTR(0),U,8)" ; Parent Location
  1. S DR=DR_";9////^S X=$P(BARTR(0),U,9)" ; Parent ASUFAC
  1. S DR=DR_";10////^S X=$P(BARTR(0),U,10)" ; A/R Section
  1. S DR=DR_";11////^S X=$P(BARTR(0),U,11)" ; Visit location
  1. S DR=DR_";12////^S X=DT" ; Date
  1. S DR=DR_";13////^S X=DUZ" ; A/R Entry by
  1. S DR=DR_";101////43" ; Transaction type (Adj)
  1. S DR=DR_";102////3" ; Adj Category (Write off)
  1. S DR=DR_";103////916" ; Adj Type (Auto Write off 2007)
  1. S DIDEL=90050
  1. D ^DIE ; Populate transaction file
  1. K DIDEL,DIE,DA,DR
  1. D TR^BARTDO(BARTRIEN) ; Post from trans to files
  1. K BARBL
  1. S BARCNT=BARCNT+1
  1. S BARBILL=$$GET1^DIQ(90050.01,$P(BARTR(0),U,4),.01)
  1. W !,BARBILL,?25," for ",$J($FN(-$P(BARTR(0),U,2),",",2),10)," written off (reversed)."
  1. Q
  1. ; *********************************************************************
  1. BILLED ;
  1. S BARBLDA=$P(BARTR(0),U,4)
  1. S ABMBIL=$$FIND3PB^BARUTL(DUZ(2),BARBLDA)
  1. ; Mark bill in 3PB Bill file as BILLED
  1. S DIE="^ABMDBILL(DUZ(2),"
  1. S DA=$P(ABMBIL,",",2)
  1. S DR=".04////B"
  1. D ^DIE
  1. K DR
  1. Q
  1. ; *********************************************************************
  1. ;
  1. XIT ;
  1. D ^BARVKL0
  1. Q