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

IVMUFNC3.m

Go to the documentation of this file.
  1. IVMUFNC3 ;ALB/CPM - BILLING TRANSMISSION UTILITIES ; 13-JUN-94
  1. ;;Version 2.0 ; INCOME VERIFICATION MATCH ;; 21-OCT-94
  1. ;;Per VHA Directive 10-93-142, this routine should not be modified.
  1. ;
  1. REV(IVMREF,DFN,IVMCL,IVMTYP,IVMBF,IVMBT,IVMAB,IVMHLD) ; Interface w/ Rev fct.
  1. ; Input: IVMREF -- Bill reference number
  1. ; DFN -- Pointer to the patient in file #2
  1. ; IVMCL -- Bill Classification [ 1-Inpt, 2-Opt ]
  1. ; IVMTYP -- Bill Type [ 2-Copayment, 3-Per Diem ]
  1. ; IVMBF -- Bill From Date in FM format
  1. ; IVMBT -- Bill To Date in FM format
  1. ; IVMAB -- Amount Billed
  1. ; IVMHLD -- Charge placed on hold? [ 1-Yes, 0-No ]
  1. ;
  1. ; Output: New entry created in file #301.61
  1. ;
  1. N IVMTDA,DA,DIK
  1. I $G(IVMREF)=""!'$G(DFN) G REVQ
  1. S IVMTDA=$O(^IVM(301.61,"B",IVMREF,0))
  1. I 'IVMTDA S IVMTDA=$$ADD(IVMREF) I 'IVMTDA G REVQ
  1. ;
  1. D NOW^%DTC
  1. S $P(^IVM(301.61,IVMTDA,0),"^",2,12)=DFN_"^"_IVMCL_"^"_IVMTYP_"^"_IVMBF_"^"_IVMBT_"^"_$S($G(IVMHLD):"",1:DT)_"^"_IVMAB_"^^^^"_$S($G(IVMHLD):0,1:1),$P(^(1),"^",3,4)=%_"^"_DUZ
  1. S DA=IVMTDA,DIK="^IVM(301.61," D IX1^DIK
  1. REVQ Q
  1. ;
  1. ADD(X) ; Add a new entry to file #301.61
  1. ; Input: X -- Reference number to be used as the .01 field
  1. ; Output: IVM -- Internal entry number to new entry, or 0.
  1. ;
  1. N DA,DD,DO,DIE,DIC,DLAYGO,IVM,Y
  1. I $G(X)="" S IVM=0 G ADDQ
  1. S DIC="^IVM(301.61,",DIC(0)="L",DLAYGO=301.61 D FILE^DICN
  1. S (DA,IVM)=+Y I DA<0 S IVM=0 G ADDQ
  1. ;
  1. D NOW^%DTC
  1. S DIE=DIC,DR="1.01////"_%_";1.02////"_DUZ D ^DIE
  1. ADDQ Q IVM
  1. ;
  1. ;
  1. CHK(DFN) ; Is the insurance patient recorded in file #301.61?
  1. ; Input: DFN -- Pointer to the patient in file #2
  1. ; Output: 1 -- Patient recorded in #301.61; otherwise, 0
  1. ;
  1. Q $O(^IVM(301.61,"C",+$G(DFN),0))>0
  1. ;
  1. ;
  1. FT1(IVMTDA) ; Entry point to build FT1 segment from file #301.61
  1. ; Input: IVMTDA -- Pointer to the transmission record in #301.61
  1. ; The HL7 variables HLFS, HLQ and HLECH must also be defined
  1. ; Output: String in the form of the HL7 FT1 segment
  1. ;
  1. N IVMN,IVMY,IVMSEP
  1. I '$G(IVMTDA) G FT1Q
  1. S IVMN=$G(^IVM(301.61,IVMTDA,0)) I IVMN="" G FT1Q
  1. S IVMSEP=$E(HLECH)
  1. ;
  1. S $P(IVMY,HLFS,1)=1 ; set id
  1. S $P(IVMY,HLFS,4)=$S($P(IVMN,"^",7):$$HLDATE^HLFNC($P(IVMN,"^",7)),1:HLQ) ; date generated
  1. S $P(IVMY,HLFS,6)=$S($P(IVMN,"^",11):2,$P(IVMN,"^",10)&$P(IVMN,"^",13):4,$P(IVMN,"^",9)&$P(IVMN,"^",13):3,1:1) ; transaction type
  1. S $P(IVMY,HLFS,7)=$P(IVMN,"^") ; transaction code
  1. ;
  1. ; - build extended transaction description
  1. S $P(IVMY,HLFS,9)=$P(IVMN,"^",3)_IVMSEP_$P(IVMN,"^",4)_IVMSEP_$S($P(IVMN,"^",5):$$HLDATE^HLFNC($P(IVMN,"^",5)),1:HLQ)_IVMSEP_$S($P(IVMN,"^",6):$$HLDATE^HLFNC($P(IVMN,"^",6)),1:HLQ)
  1. ;
  1. ; - build extended transaction amount
  1. S $P(IVMY,HLFS,11)=$S($P(IVMN,"^",10)&$P(IVMN,"^",13):+$P(IVMN,"^",9),$P(IVMN,"^",9)&$P(IVMN,"^",13):$P(IVMN,"^",9),1:$P(IVMN,"^",8))
  1. ;
  1. FT1Q Q "FT1"_HLFS_$G(IVMY)