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

BZSMAWO3.m

Go to the documentation of this file.
  1. BZSMAWO3 ; IHS/TAO/EDE - WRITE OFF OLD BILLS REVERSAL [ 04/06/2003 9:29 AM ]
  1. ;;1.0;TUCSON AREA OFFICE W/O;;MAR 14, 2003
  1. ;
  1. ; Reverse all transactions of transaction type 43 (Adjustment)
  1. ; with Adjustment category 3 (Write-off)
  1. ; with Adjustment type 1003 (TAO Auto Write-off)
  1. ;
  1. START ;
  1. D NOW^%DTC
  1. S BZSNOW=%
  1. D NOTE
  1. Q:'BZSCONT
  1. D LOOP
  1. W !!,BZSCNT," Bills with Auto Write off (1003) reversed."
  1. D EOJ
  1. Q
  1. ;
  1. ;--------------------
  1. NOTE ; TELL USER WHAT IS GOING TO HAPPEN
  1. S BZSCONT=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 1003 (Paid Denied Over Stat Limit)"
  1. W !?7,"will be reversed by creating a new transaction of the same type,"
  1. W !?7,"but negative dollar amount."
  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:BZSDONE
  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 BZSCONT=1
  1. Q
  1. ;
  1. ;--------------------
  1. CHECK ;
  1. ; Check to see if this option has already been run
  1. S BZSDONE=0
  1. I $D(^BZSTMP("AWO-REVERSE")) D Q
  1. . S Y=^BZSTMP("AWO-REVERSE")
  1. . D DD^%DT
  1. . S BZSDONDT=Y
  1. . S BZSDONE=1
  1. . S $P(BZSDASH,"*",54)=""
  1. . W !!?14,BZSDASH
  1. . W !?14,"* This routine was already executed on ",BZSDONDT,". *"
  1. . W !?14,"*",?24,"It may not be executed again.",?66,"*"
  1. . W !?14,BZSDASH
  1. . D EOP^BARUTL(0)
  1. Q
  1. ;
  1. ;--------------------
  1. LOOP ; LOOP ALL DUZ(2) IN TRANSACTION FILE
  1. S BZSCNT=0
  1. S ^BZSTMP("AWO-REVERSE")=DT
  1. S BZSHOLD=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)=BZSHOLD
  1. Q
  1. ;
  1. ;--------------------
  1. TRANS ; LOOP TRANSACTIONS FOR EACH DUZ(2)
  1. ; Loop transactions after 03/01/2003 @ 7:00 for each DUZ(2). This
  1. ; date and time used because code 1003 did not exist before then.
  1. S BZSDTTR=3030301.07
  1. F S BZSDTTR=$O(^BARTR(DUZ(2),BZSDTTR)) Q:('+BZSDTTR!(BZSDTTR>BZSNOW)) D ISITAWO
  1. Q
  1. ;
  1. ;--------------------
  1. ISITAWO ; CHECK TO SEE IF TRANS IS TAO AWO 1003
  1. S BZSTR(0)=$G(^BARTR(DUZ(2),BZSDTTR,0)) ; A/R Transaction 0 node
  1. S BZSTR(1)=$G(^BARTR(DUZ(2),BZSDTTR,1)) ; A/R Transaction 1 node
  1. I $P(BZSTR(1),U)=43,$P(BZSTR(1),U,2)=3,$P(BZSTR(1),U,3)=1003 D
  1. . D REVERSE
  1. . D ROLLBILL
  1. Q
  1. ;
  1. ;--------------------
  1. REVERSE ; REVERSE THE TAO 1003 WRITE OFF
  1. S BZSTRIEN=$$NEW^BARTR ; Create new transaction
  1. S DA=BZSTRIEN
  1. S DIE=90050.03
  1. S DR="2////^S X=-$P(BZSTR(0),U,2)" ; Credit ($$$)
  1. S DR=DR_";4////^S X=$P(BZSTR(0),U,4)" ; A/R Bill
  1. S DR=DR_";5////^S X=$P(BZSTR(0),U,5)" ; A/R Patient
  1. S DR=DR_";6////^S X=$P(BZSTR(0),U,6)" ; A/R Account
  1. S DR=DR_";8////^S X=$P(BZSTR(0),U,8)" ; Parent Location
  1. S DR=DR_";9////^S X=$P(BZSTR(0),U,9)" ; Parent ASUFAC
  1. S DR=DR_";10////^S X=$P(BZSTR(0),U,10)" ; A/R Section
  1. S DR=DR_";11////^S X=$P(BZSTR(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////1003" ; Adj Type (TAO Auto Write off)
  1. S DIDEL=90050
  1. D ^BARDIE ; Populate transaction file
  1. K DIDEL,DIE,DA,DR
  1. D TR^BARTDO(BZSTRIEN) ; Post from trans to files
  1. K BARBL
  1. S BZSCNT=BZSCNT+1
  1. S BZSBILL=$$GET1^DIQ(90050.01,$P(BZSTR(0),U,4),.01)
  1. W !,BZSBILL,?25," for ",$J($FN(-$P(BZSTR(0),U,2),",",2),10)," written off (reversed)."
  1. Q
  1. ;
  1. ;--------------------
  1. ROLLBILL ; UPDATE PAYMENT MULTIPLE IN 3PB, MARK AS BILLED IN 3PB
  1. ; For bills reversed, update the payment multiple in 3PB and mark the
  1. ; bill as BILLED in 3PB Bill File.
  1. S BARBLDA=$P(BZSTR(0),U,4)
  1. D SETVAR^BARROLL ; Set A/R vars to roll to 3PB
  1. D ROLL^BZSMAWO2
  1. D BILLED
  1. Q
  1. ;
  1. ;--------------------
  1. BILLED ; MARK BILL IN 3PB BILL FILE AS BILLED
  1. S DIE="^ABMDBILL(DUZ(2),"
  1. S DA=ABMP("BDFN")
  1. S DR=".04////B"
  1. D ^DIE
  1. K DR
  1. Q
  1. ;
  1. ;--------------------
  1. EOJ ;
  1. ;D ^BARVKL0
  1. D EN^XBVK("BAR"),EN^XBVK("AMB")
  1. Q