ACHSEP ; IHS/ITSC/PMF - utility to set certain counts equal automagically ; [ 10/16/2001 8:16 AM ]
;;3.1;CONTRACT HEALTH MGMT SYSTEM;;JUN 11, 2001
;;3.0;CONTRACT HEALTH MGMT SYSTEM;;SEP 17, 1997
;utility to set certain counts equal automagically
;
;The node ^ACHS("9",facility,"FY",year,"W","0") keeps
;a count of something two ways. The counts are supposed
;to come out even, but they don't.
;
;It is unimportant, because instead of going back to find
;out why the counts differ, we just set them equal and go on.
;
;This utility allows a user to set the counts equal whenever
;they want.
;
N COMMA,DATA,DATH,DOLH,FAC,FOUR,FY,HAT,ODAT,THREE
;
D INIT
;
W !!,"starting...",!
;
S DOLH=$TR($H,COMMA,HAT) S DATH=+DOLH
;
;get rid of records older than 30 days
S ODAT="" F S ODAT=$O(^TEMP("ACHSEP",ODAT)) Q:ODAT="" Q:+ODAT+30>DATH K ^TEMP("ACHSEP")
;
S ^TEMP("ACHSEP",DOLH)=""
;
;For each facility, get each fiscal year.
; for each fiscal year, set the counts equal
S FAC=0 F S FAC=$O(^ACHS(9,FAC)) Q:FAC="" D
. S FY=0 F S FY=$O(^ACHS(9,FAC,"FY",FY)) Q:FY="" D
.. S DATA=$G(^ACHS(9,FAC,"FY",FY,"W",0))
.. I DATA="" Q
.. S THREE=$P(DATA,HAT,3),FOUR=$P(DATA,HAT,4)
.. I $R(3)'=2 I THREE=FOUR Q
.. S $P(DATA,HAT,4)=THREE,^ACHS(9,FAC,"FY",FY,"W",0)=DATA
.. S ^TEMP("ACHSEP",DOLH,FAC,FY)=THREE_HAT_FOUR
.. Q
. Q
;
W !!,"finished. press return ",!!! R HAT:60
Q
INIT ;
S COMMA=","
S HAT="^"
Q
ACHSEP ; IHS/ITSC/PMF - utility to set certain counts equal automagically ; [ 10/16/2001 8:16 AM ]
+1 ;;3.1;CONTRACT HEALTH MGMT SYSTEM;;JUN 11, 2001
+2 ;;3.0;CONTRACT HEALTH MGMT SYSTEM;;SEP 17, 1997
+3 ;utility to set certain counts equal automagically
+4 ;
+5 ;The node ^ACHS("9",facility,"FY",year,"W","0") keeps
+6 ;a count of something two ways. The counts are supposed
+7 ;to come out even, but they don't.
+8 ;
+9 ;It is unimportant, because instead of going back to find
+10 ;out why the counts differ, we just set them equal and go on.
+11 ;
+12 ;This utility allows a user to set the counts equal whenever
+13 ;they want.
+14 ;
+15 NEW COMMA,DATA,DATH,DOLH,FAC,FOUR,FY,HAT,ODAT,THREE
+16 ;
+17 DO INIT
+18 ;
+19 WRITE !!,"starting...",!
+20 ;
+21 SET DOLH=$TRANSLATE($HOROLOG,COMMA,HAT)
SET DATH=+DOLH
+22 ;
+23 ;get rid of records older than 30 days
+24 SET ODAT=""
FOR
SET ODAT=$ORDER(^TEMP("ACHSEP",ODAT))
IF ODAT=""
QUIT
IF +ODAT+30>DATH
QUIT
KILL ^TEMP("ACHSEP")
+25 ;
+26 SET ^TEMP("ACHSEP",DOLH)=""
+27 ;
+28 ;For each facility, get each fiscal year.
+29 ; for each fiscal year, set the counts equal
+30 SET FAC=0
FOR
SET FAC=$ORDER(^ACHS(9,FAC))
IF FAC=""
QUIT
Begin DoDot:1
+31 SET FY=0
FOR
SET FY=$ORDER(^ACHS(9,FAC,"FY",FY))
IF FY=""
QUIT
Begin DoDot:2
+32 SET DATA=$GET(^ACHS(9,FAC,"FY",FY,"W",0))
+33 IF DATA=""
QUIT
+34 SET THREE=$PIECE(DATA,HAT,3)
SET FOUR=$PIECE(DATA,HAT,4)
+35 IF $RANDOM(3)'=2
IF THREE=FOUR
QUIT
+36 SET $PIECE(DATA,HAT,4)=THREE
SET ^ACHS(9,FAC,"FY",FY,"W",0)=DATA
+37 SET ^TEMP("ACHSEP",DOLH,FAC,FY)=THREE_HAT_FOUR
+38 QUIT
End DoDot:2
+39 QUIT
End DoDot:1
+40 ;
+41 WRITE !!,"finished. press return ",!!!
READ HAT:60
+42 QUIT
INIT ;
+1 SET COMMA=","
+2 SET HAT="^"
+3 QUIT