ABMMRS4 ; IHS/ASDST/DMJ - STANDALONE TO FIX CORRUPTED DATA IN BILL FILE ;
;;2.4;IHS 3P BILLING SYSTEM;;APR 14, 2000
;IHS/DSD/MRS
;
INIT S (CLAIM,BDFN,DFN,SITE)="",X="BILL",Y="NULL",U="^"
S DIE="^ABMDBILL(DUZ(2),"
F S CLAIM=$O(^ABMMRS1(CLAIM)) Q:CLAIM="" D
.F S BDFN=$O(^ABMMRS1(CLAIM,BDFN)) Q:BDFN="" D
..F S SITE=$O(^ABMMRS(CLAIM,BDFN,"BILL","NULL",SITE)) Q:SITE="" D SEP
Q
SEP ;Separate pieces from string to re-populate bill file
I '$D(^ABMDBILL(SITE,BDFN,0)) S ^ABMMRS99(CLAIM,BDFN,SITE)="" Q ;Trap
S TMP=^ABMDBILL(SITE,BDFN,0),TMPAT=$P(TMP,U,6),TMPBTYP=$P(TMP,U,2)
I TMPAT'="" S ^ABMMRS99(CLAIM,BDFN,SITE)=TMP Q ; Trap suspect bills
I $L(TMP,U)'=4 S ^ABMMRS99(CLAIM,BDFN,SITE)=TMP Q ; Trap suspect bills
; OK to piece and set
S STR=^ABMMRS1(CLAIM,BDFN,"BILL","NULL",SITE)
S BTYP=$P(STR,U,2),VLOC=$P(STR,U,3),STAT=$P(STR,U,4)
S PAT=$P(STR,U,5),MODE=$P(STR,U,6),VTYP=$P(STR,U,7),IIEN=$P(STR,U,8)
S CODE=$P(STR,U,9),CLINIC=$P(STR,U,10)
I VLOC="" S VLOC=SITE
I BTYP="" S BTYP=TMPBTYP
D SET
Q
SET ; Use fileman and re-populate bill file
S DA=BDFN,DUZ(2)=SITE
S DR=".03////"_VLOC_";.04////"_STAT_";.05////"_PAT_";.06////"_MODE_";.07////"_VTYP_";.08////"_IIEN_";.09////"_CODE_";.1////"_CLINIC
D ^DIE K DA,DR
Q
ABMMRS4 ; IHS/ASDST/DMJ - STANDALONE TO FIX CORRUPTED DATA IN BILL FILE ;
+1 ;;2.4;IHS 3P BILLING SYSTEM;;APR 14, 2000
+2 ;IHS/DSD/MRS
+3 ;
INIT SET (CLAIM,BDFN,DFN,SITE)=""
SET X="BILL"
SET Y="NULL"
SET U="^"
+1 SET DIE="^ABMDBILL(DUZ(2),"
+2 FOR
SET CLAIM=$ORDER(^ABMMRS1(CLAIM))
IF CLAIM=""
QUIT
Begin DoDot:1
+3 FOR
SET BDFN=$ORDER(^ABMMRS1(CLAIM,BDFN))
IF BDFN=""
QUIT
Begin DoDot:2
+4 FOR
SET SITE=$ORDER(^ABMMRS(CLAIM,BDFN,"BILL","NULL",SITE))
IF SITE=""
QUIT
DO SEP
End DoDot:2
End DoDot:1
+5 QUIT
SEP ;Separate pieces from string to re-populate bill file
+1 ;Trap
IF '$DATA(^ABMDBILL(SITE,BDFN,0))
SET ^ABMMRS99(CLAIM,BDFN,SITE)=""
QUIT
+2 SET TMP=^ABMDBILL(SITE,BDFN,0)
SET TMPAT=$PIECE(TMP,U,6)
SET TMPBTYP=$PIECE(TMP,U,2)
+3 ; Trap suspect bills
IF TMPAT'=""
SET ^ABMMRS99(CLAIM,BDFN,SITE)=TMP
QUIT
+4 ; Trap suspect bills
IF $LENGTH(TMP,U)'=4
SET ^ABMMRS99(CLAIM,BDFN,SITE)=TMP
QUIT
+5 ; OK to piece and set
+6 SET STR=^ABMMRS1(CLAIM,BDFN,"BILL","NULL",SITE)
+7 SET BTYP=$PIECE(STR,U,2)
SET VLOC=$PIECE(STR,U,3)
SET STAT=$PIECE(STR,U,4)
+8 SET PAT=$PIECE(STR,U,5)
SET MODE=$PIECE(STR,U,6)
SET VTYP=$PIECE(STR,U,7)
SET IIEN=$PIECE(STR,U,8)
+9 SET CODE=$PIECE(STR,U,9)
SET CLINIC=$PIECE(STR,U,10)
+10 IF VLOC=""
SET VLOC=SITE
+11 IF BTYP=""
SET BTYP=TMPBTYP
+12 DO SET
+13 QUIT
SET ; Use fileman and re-populate bill file
+1 SET DA=BDFN
SET DUZ(2)=SITE
+2 SET DR=".03////"_VLOC_";.04////"_STAT_";.05////"_PAT_";.06////"_MODE_";.07////"_VTYP_";.08////"_IIEN_";.09////"_CODE_";.1////"_CLINIC
+3 DO ^DIE
KILL DA,DR
+4 QUIT