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

BARFRAPI.m

Go to the documentation of this file.
  1. BARFRAPI ; IHS/SD/LSL - A/R Flat Rate API ;
  1. ;;1.8;IHS ACCOUNTS RECEIVABLE;;OCT 26, 2005
  1. ;
  1. ; IHS/SD/SDR - BAR*1.6*3 - 9/16/2002 - QDA-0802-130076
  1. ; Modified routine to populate current balance correctly
  1. ; Also added a line to new DA so it doesn't get overwritten
  1. ; for 3PB routine
  1. ;
  1. Q
  1. ;
  1. ; *********************************************************************
  1. EN(BAR) ; PEP
  1. ; API to pass Flat Rate Adjustments from 3PB to A/R
  1. ; This API is expecting the difference between what the Flat Rate was
  1. ; and what the new rate is. A transaction will be created for the
  1. ; difference with a transaction type of FRA. The amount billed and
  1. ; current bill amount will be adjusted accordingly.
  1. ;
  1. ; Pass in array where:
  1. ; BAR("USER") User who enters transaction
  1. ; BAR("ADJ AMT") Dollar amount of transaction
  1. ; BAR("ARLOC") Location of A/R bill DUZ(2),IEN
  1. ; BAR("TRAN TYPE") Type of transaction to post
  1. ;
  1. ; -------------------------------
  1. ;
  1. N DA
  1. I '$G(BAR("ADJ AMT"))!('$G(BAR("ARLOC")))!('$G(BAR("TRAN TYPE"))) Q ""
  1. I $G(BAR("TRAN TYPE"))'=503 Q "NOT FRA TRANSACTION TYPE"
  1. I '+BAR("ADJ AMT") Q "NO AMOUNT ENTERED"
  1. ;
  1. ; Set BARUSR(29,"I") to accomodate input transforms on many A/R fields.
  1. ; This value must match the Service section on the transaction.
  1. ; Service/Section must be Business Office (8) for A/R
  1. ;
  1. S BARUSR(29,"I")=8
  1. S BARHOLD=DUZ(2)
  1. S DUZ(2)=+BAR("ARLOC")
  1. S BARBLIEN=$P(BAR("ARLOC"),",",2)
  1. I 'BARBLIEN Q "No A/R bill to post to"
  1. ;
  1. S BARBLPAT=$$GET1^DIQ(90050.01,BARBLIEN,101,"I") ; A/R Patient IEN
  1. S BARBLAC=$$GET1^DIQ(90050.01,BARBLIEN,3,"I") ; A/R Account
  1. S BARVIST=$$GET1^DIQ(90050.01,BARBLIEN,108,"I") ; A/R Visit loc
  1. S BARTRIEN=$$NEW^BARTR ; Create New Transaction
  1. I +BARTRIEN<1 Q "A/R TRANSACTION NOT CREATED"
  1. ;
  1. ; Populate Transaction file
  1. S DA=BARTRIEN ; IEN to A/R TRANSACTION
  1. S DIE=90050.03
  1. I $E(BAR("ADJ AMT"),1)="-" S DR="2////^S X=BAR(""ADJ AMT"")" ; Credit
  1. E S DR="3////^S X=BAR(""ADJ AMT"")" ; Debit
  1. S DR=DR_";4////^S X=BARBLIEN" ; A/R Bill
  1. S DR=DR_";5////^S X=BARBLPAT" ; A/R Patient
  1. S DR=DR_";6////^S X=BARBLAC" ; A/R Account
  1. S DR=DR_";8////^S X=DUZ(2)" ; Parent Location
  1. S DR=DR_";9////^S X=DUZ(2)" ; Parent ASUFAC
  1. ;
  1. ; Force A/R section to Business Office
  1. S DR=DR_";10////8" ; A/R Section
  1. S DR=DR_";11////^S X=BARVIST" ; Visit Location
  1. S DR=DR_";12////^S X=DT" ; Date
  1. S DR=DR_";13////^S X=BAR(""USER"")" ; Entry by
  1. S DR=DR_";101////^S X=BAR(""TRAN TYPE"")" ; Transaction Type
  1. S DIDEL=90050
  1. D ^DIE
  1. K DIDEL,DIE,DA,DR
  1. ;
  1. ; Adjust bill amount and current bill amount to reflect difference
  1. S BARBAMT=$P($G(^BARBL(DUZ(2),BARBLIEN,0)),U,13) ;amount billed
  1. S BARCBAMT=$P($G(^BARBL(DUZ(2),BARBLIEN,0)),U,15) ;current bill amount
  1. S DR="13////^S X=BARBAMT+BAR(""ADJ AMT"")" ;adjust amount billed
  1. S DR=DR_";15////^S X=BARCBAMT+BAR(""ADJ AMT"")" ;adj current bill amt
  1. S DIE=90050.01 ;A/R bill file
  1. S DA=BARBLIEN
  1. D ^DIE
  1. ;
  1. ; Post from transaction file to related files
  1. D TR^BARTDO(BARTRIEN) ;Pull trans info and update PSR
  1. S DUZ(2)=BARHOLD
  1. Q BAR("ARLOC")