BARUFCLR ; IHS/SD/TPF - CLEAR "NOT SENT" ENTRIES FROM SESSION LOG FILE ;
;;1.8;IHS ACCOUNTS RECEIVABLE;**4**;JAN 10, 2008
Q
;ORIGINALLY WRITTEN TO CLEAR ENTRIES THAT HAD A REASON NOT SENT CODE OF "NR"
;THIS MAY CHANGE WHO KNOWS
;
;TARGET SHOULD BE A LIST OF CODES DELINETAED BY U
;U_NR_U_NEG_U
;IF WE MAKE THIS SET OF CODES TO A FILE. MAKE THE .01 FIELD THE CODE
;ENTRIES WITH A REASON NOT SENT CODE CONTAINED BY TARGET WILL BE DELETED
;
;CALL THIS TAG WITH CODES TO BE DELETED OR COUNTED. IF 'REPORT' IS TRUE YOU
;WILL GET ONLY A COUNT OF THE CODES THAT ARE IN THE NS OR DS BUCKET. OTHERWISE THE ENTRIES
;CONTAINING THOSE CODES WILL BE CLEARED OF THE NS OD DS FLAGS
;
;CALL STARTNS TO DEAL WITH THE "NOT SENT" FLAG
;CALL STARTDS TO DEAL WITH THE "DELAYED SEND" FLAG
;
;THE 'COUNT' FLAG CAN BE USED TO GET AN ESTIMATE OF THE NUMBER OF TRANSMITTED
;SESSIONS/TRANSACTIONS THAT WILL BE PROCESSED BY THE POST INIT (OR RESEND FUNCTION ^BARUFEX2)
;
;
STARTNS(TARGET,REPORT) ;EP - START CLEARING NOT SENT ENTRIES
Q:$G(TARGET)=""
Q:$G(REPORT)=""
N TEMPDUZ2,UDUZ,SESSID,TRDATE,IENS,COUNT
S TEMPDUZ2=DUZ(2)
S DUZ(2)=1
F S DUZ(2)=$O(^BARSESS(DUZ(2))) Q:'DUZ(2) D
.S TRDATE=""
.F S TRDATE=$O(^BARSESS(DUZ(2),"NS",TRDATE)) Q:'TRDATE D
..S SESSID=""
..F S SESSID=$O(^BARSESS(DUZ(2),"NS",TRDATE,SESSID)) Q:'SESSID D
...S UDUZ=""
...F S UDUZ=$O(^BARSESS(DUZ(2),"NS",TRDATE,SESSID,UDUZ)) Q:'UDUZ D
....S IENS=TRDATE_","_SESSID_","_UDUZ_","
....S REASON=$$GET1^DIQ(90057.110102,IENS,.09,"I")
....S XREASON=$$GET1^DIQ(90057.110102,IENS,.09,"E")
....I TARGET'="ALL" Q:TARGET'[(U_REASON_U)
....W !,TRDATE,?25,REASON,?30,XREASON
....I $G(REPORT) S COUNT(DUZ(2),REASON)=$G(COUNT(DUZ(2),REASON))+1
....I '$G(REPORT) D DELNOT Q ;CLEAR NOT SENT FLAG
I $G(REPORT) D REPORT(.COUNT)
S DUZ(2)=TEMPDUZ2
Q
;
STARTDS(TARGET,REPORT) ;EP - START CLEARING NOT SENT ENTRIES
Q:$G(TARGET)=""
Q:$G(REPORT)=""
N TEMPDUZ2,UDUZ,SESSID,TRDATE,IENS,COUNT
S TEMPDUZ2=DUZ(2)
S DUZ(2)=1
F S DUZ(2)=$O(^BARSESS(DUZ(2))) Q:'DUZ(2) D
.S TRDATE=""
.F S TRDATE=$O(^BARSESS(DUZ(2),"DS",TRDATE)) Q:'TRDATE D
..S SESSID=""
..F S SESSID=$O(^BARSESS(DUZ(2),"DS",TRDATE,SESSID)) Q:'SESSID D
...S UDUZ=""
...F S UDUZ=$O(^BARSESS(DUZ(2),"DS",TRDATE,SESSID,UDUZ)) Q:'UDUZ D
....S IENS=TRDATE_","_SESSID_","_UDUZ_","
....S REASON=$$GET1^DIQ(90057.110102,IENS,.09,"I")
....S XREASON=$$GET1^DIQ(90057.110102,IENS,.09,"E")
....I TARGET'="ALL" Q:TARGET'[(U_REASON_U)
....W !,TRDATE,?25,REASON,?30,XREASON
....I $G(REPORT) S COUNT(DUZ(2),REASON)=$G(COUNT(DUZ(2),REASON))+1
....I '$G(REPORT) D DELDS Q ;CLEAR DELAYED FLAG
I $G(REPORT) D REPORT(.COUNT)
S DUZ(2)=TEMPDUZ2
Q
;
DELNOT ;EP - CLEAR THE NS FLAGS
K DIK,DA
S DA(2)=UDUZ
S DA(1)=SESSID
S DA=TRDATE
S DIE="^BARSESS("_DUZ(2)_","_DA(2)_",11,"_DA(1)_",2,"
S DR=".06///@;.09///@" ;CLEAR 'NOT SENT' AND 'REASON NOT SENT'
D ^DIE
Q
DELDS ;EP - DELETE THE DS FLAGS
K DIK,DA
S DA(2)=UDUZ
S DA(1)=SESSID
S DA=TRDATE
S DIE="^BARSESS("_DUZ(2)_","_DA(2)_",11,"_DA(1)_",2,"
S DR=".07///@;.09///@" ;CLEAR 'NOT SENT' AND 'REASON NOT SENT'
D ^DIE
Q
;
REPORT(COUNT) ;EP - REPORT # ENTRIES DELETED
N DUZ2,REASON
D HDR
S DUZ2=""
F S DUZ2=$O(COUNT(DUZ2)) Q:'DUZ2 D
.S REASON=""
.F S REASON=$O(COUNT(DUZ2,REASON)) Q:REASON="" D
..W !,$$GET1^DIQ(9999999.06,DUZ2_",",.01,"E")
..W ?30,REASON
..W ?60,COUNT(DUZ2,REASON)
Q
HDR ;EP - REPORT HEADER
W @IOF
W !,"NUMBER OF ENTRIES DELETED FROM THE ""NOT SENT"" BUCKET"
W !,"FACILITY"
W ?30,"REASON"
W ?45,"# FOUND"
W !,"--------"
W ?30,"------"
W ?60,"---------"
Q
;
;DOCS ABOVE
;THE INSTALER IS THE DUZ OF THE INSTALLER OF PATCH 4
;WE NEED TO SKIP THE RESEND SESSION IF THIS IS A BETA SITE
COUNT(INSTALER) ;EP - COUNT NUMBER OF TRANSACTIONS IN SESSION LOG THAT WOULD BE PROCESSED BY THE POST INIT (BARUFEX2)
N TEMPDUZ2,UDUZ,SESSID,TRDATE,COUNT
S COUNT=0
S TEMPDUZ2=DUZ(2)
S DUZ(2)=1
F S DUZ(2)=$O(^BARSESS(DUZ(2))) Q:'DUZ(2) D
.S UDUZ=0
.F S UDUZ=$O(^BARSESS(DUZ(2),UDUZ)) Q:'UDUZ D
..I $G(INSTALER) Q:UDUZ=INSTALER
..S SESSID=0
..F S SESSID=$O(^BARSESS(DUZ(2),UDUZ,11,SESSID)) Q:'SESSID D
...S TRDATE=0
...F S TRDATE=$O(^BARSESS(DUZ(2),UDUZ,11,SESSID,2,TRDATE)) Q:'TRDATE D
....Q:'$O(^BARSESS(DUZ(2),UDUZ,11,SESSID,21,0))&('$$GET1^DIQ(90057.110102,TRDATE_","_SESSID_","_UDUZ_",",.02,"I"))
....S COUNT=COUNT+1
W !,COUNT
S DUZ(2)=TEMPDUZ2
Q
;
STARTST ;EP - LETS GET A COUNT OF INDIVIDUALLY SENT TRANSACTIONS
N TEMPDUZ2,UDUZ,SESSID,TRDATE,COUNT
S COUNT=0
S TEMPDUZ2=DUZ(2)
S DUZ(2)=1
F S DUZ(2)=$O(^BARSESS(DUZ(2))) Q:'DUZ(2) D
.S UDUZ=0
.F S UDUZ=$O(^BARSESS(DUZ(2),UDUZ)) Q:'UDUZ D
..I $G(INSTALER) Q:UDUZ=INSTALER
..S SESSID=0
..F S SESSID=$O(^BARSESS(DUZ(2),UDUZ,11,SESSID)) Q:'SESSID D
...S TRDATE=0
...F S TRDATE=$O(^BARSESS(DUZ(2),UDUZ,11,SESSID,2,TRDATE)) Q:'TRDATE D
....Q:'$$GET1^DIQ(90057.110102,TRDATE_","_SESSID_","_UDUZ_",",.02,"I") ;A/R UFMS SESSION LOG, TRANSMITTED?
....W !,UDUZ,?10,SESSID,?25,TRDATE
....S COUNT=COUNT+1
W !,COUNT
S DUZ(2)=TEMPDUZ2
Q
BARUFCLR ; IHS/SD/TPF - CLEAR "NOT SENT" ENTRIES FROM SESSION LOG FILE ;
+1 ;;1.8;IHS ACCOUNTS RECEIVABLE;**4**;JAN 10, 2008
+2 QUIT
+3 ;ORIGINALLY WRITTEN TO CLEAR ENTRIES THAT HAD A REASON NOT SENT CODE OF "NR"
+4 ;THIS MAY CHANGE WHO KNOWS
+5 ;
+6 ;TARGET SHOULD BE A LIST OF CODES DELINETAED BY U
+7 ;U_NR_U_NEG_U
+8 ;IF WE MAKE THIS SET OF CODES TO A FILE. MAKE THE .01 FIELD THE CODE
+9 ;ENTRIES WITH A REASON NOT SENT CODE CONTAINED BY TARGET WILL BE DELETED
+10 ;
+11 ;CALL THIS TAG WITH CODES TO BE DELETED OR COUNTED. IF 'REPORT' IS TRUE YOU
+12 ;WILL GET ONLY A COUNT OF THE CODES THAT ARE IN THE NS OR DS BUCKET. OTHERWISE THE ENTRIES
+13 ;CONTAINING THOSE CODES WILL BE CLEARED OF THE NS OD DS FLAGS
+14 ;
+15 ;CALL STARTNS TO DEAL WITH THE "NOT SENT" FLAG
+16 ;CALL STARTDS TO DEAL WITH THE "DELAYED SEND" FLAG
+17 ;
+18 ;THE 'COUNT' FLAG CAN BE USED TO GET AN ESTIMATE OF THE NUMBER OF TRANSMITTED
+19 ;SESSIONS/TRANSACTIONS THAT WILL BE PROCESSED BY THE POST INIT (OR RESEND FUNCTION ^BARUFEX2)
+20 ;
+21 ;
STARTNS(TARGET,REPORT) ;EP - START CLEARING NOT SENT ENTRIES
+1 IF $GET(TARGET)=""
QUIT
+2 IF $GET(REPORT)=""
QUIT
+3 NEW TEMPDUZ2,UDUZ,SESSID,TRDATE,IENS,COUNT
+4 SET TEMPDUZ2=DUZ(2)
+5 SET DUZ(2)=1
+6 FOR
SET DUZ(2)=$ORDER(^BARSESS(DUZ(2)))
IF 'DUZ(2)
QUIT
Begin DoDot:1
+7 SET TRDATE=""
+8 FOR
SET TRDATE=$ORDER(^BARSESS(DUZ(2),"NS",TRDATE))
IF 'TRDATE
QUIT
Begin DoDot:2
+9 SET SESSID=""
+10 FOR
SET SESSID=$ORDER(^BARSESS(DUZ(2),"NS",TRDATE,SESSID))
IF 'SESSID
QUIT
Begin DoDot:3
+11 SET UDUZ=""
+12 FOR
SET UDUZ=$ORDER(^BARSESS(DUZ(2),"NS",TRDATE,SESSID,UDUZ))
IF 'UDUZ
QUIT
Begin DoDot:4
+13 SET IENS=TRDATE_","_SESSID_","_UDUZ_","
+14 SET REASON=$$GET1^DIQ(90057.110102,IENS,.09,"I")
+15 SET XREASON=$$GET1^DIQ(90057.110102,IENS,.09,"E")
+16 IF TARGET'="ALL"
IF TARGET'[(U_REASON_U)
QUIT
+17 WRITE !,TRDATE,?25,REASON,?30,XREASON
+18 IF $GET(REPORT)
SET COUNT(DUZ(2),REASON)=$GET(COUNT(DUZ(2),REASON))+1
+19 ;CLEAR NOT SENT FLAG
IF '$GET(REPORT)
DO DELNOT
QUIT
End DoDot:4
End DoDot:3
End DoDot:2
End DoDot:1
+20 IF $GET(REPORT)
DO REPORT(.COUNT)
+21 SET DUZ(2)=TEMPDUZ2
+22 QUIT
+23 ;
STARTDS(TARGET,REPORT) ;EP - START CLEARING NOT SENT ENTRIES
+1 IF $GET(TARGET)=""
QUIT
+2 IF $GET(REPORT)=""
QUIT
+3 NEW TEMPDUZ2,UDUZ,SESSID,TRDATE,IENS,COUNT
+4 SET TEMPDUZ2=DUZ(2)
+5 SET DUZ(2)=1
+6 FOR
SET DUZ(2)=$ORDER(^BARSESS(DUZ(2)))
IF 'DUZ(2)
QUIT
Begin DoDot:1
+7 SET TRDATE=""
+8 FOR
SET TRDATE=$ORDER(^BARSESS(DUZ(2),"DS",TRDATE))
IF 'TRDATE
QUIT
Begin DoDot:2
+9 SET SESSID=""
+10 FOR
SET SESSID=$ORDER(^BARSESS(DUZ(2),"DS",TRDATE,SESSID))
IF 'SESSID
QUIT
Begin DoDot:3
+11 SET UDUZ=""
+12 FOR
SET UDUZ=$ORDER(^BARSESS(DUZ(2),"DS",TRDATE,SESSID,UDUZ))
IF 'UDUZ
QUIT
Begin DoDot:4
+13 SET IENS=TRDATE_","_SESSID_","_UDUZ_","
+14 SET REASON=$$GET1^DIQ(90057.110102,IENS,.09,"I")
+15 SET XREASON=$$GET1^DIQ(90057.110102,IENS,.09,"E")
+16 IF TARGET'="ALL"
IF TARGET'[(U_REASON_U)
QUIT
+17 WRITE !,TRDATE,?25,REASON,?30,XREASON
+18 IF $GET(REPORT)
SET COUNT(DUZ(2),REASON)=$GET(COUNT(DUZ(2),REASON))+1
+19 ;CLEAR DELAYED FLAG
IF '$GET(REPORT)
DO DELDS
QUIT
End DoDot:4
End DoDot:3
End DoDot:2
End DoDot:1
+20 IF $GET(REPORT)
DO REPORT(.COUNT)
+21 SET DUZ(2)=TEMPDUZ2
+22 QUIT
+23 ;
DELNOT ;EP - CLEAR THE NS FLAGS
+1 KILL DIK,DA
+2 SET DA(2)=UDUZ
+3 SET DA(1)=SESSID
+4 SET DA=TRDATE
+5 SET DIE="^BARSESS("_DUZ(2)_","_DA(2)_",11,"_DA(1)_",2,"
+6 ;CLEAR 'NOT SENT' AND 'REASON NOT SENT'
SET DR=".06///@;.09///@"
+7 DO ^DIE
+8 QUIT
DELDS ;EP - DELETE THE DS FLAGS
+1 KILL DIK,DA
+2 SET DA(2)=UDUZ
+3 SET DA(1)=SESSID
+4 SET DA=TRDATE
+5 SET DIE="^BARSESS("_DUZ(2)_","_DA(2)_",11,"_DA(1)_",2,"
+6 ;CLEAR 'NOT SENT' AND 'REASON NOT SENT'
SET DR=".07///@;.09///@"
+7 DO ^DIE
+8 QUIT
+9 ;
REPORT(COUNT) ;EP - REPORT # ENTRIES DELETED
+1 NEW DUZ2,REASON
+2 DO HDR
+3 SET DUZ2=""
+4 FOR
SET DUZ2=$ORDER(COUNT(DUZ2))
IF 'DUZ2
QUIT
Begin DoDot:1
+5 SET REASON=""
+6 FOR
SET REASON=$ORDER(COUNT(DUZ2,REASON))
IF REASON=""
QUIT
Begin DoDot:2
+7 WRITE !,$$GET1^DIQ(9999999.06,DUZ2_",",.01,"E")
+8 WRITE ?30,REASON
+9 WRITE ?60,COUNT(DUZ2,REASON)
End DoDot:2
End DoDot:1
+10 QUIT
HDR ;EP - REPORT HEADER
+1 WRITE @IOF
+2 WRITE !,"NUMBER OF ENTRIES DELETED FROM THE ""NOT SENT"" BUCKET"
+3 WRITE !,"FACILITY"
+4 WRITE ?30,"REASON"
+5 WRITE ?45,"# FOUND"
+6 WRITE !,"--------"
+7 WRITE ?30,"------"
+8 WRITE ?60,"---------"
+9 QUIT
+10 ;
+11 ;DOCS ABOVE
+12 ;THE INSTALER IS THE DUZ OF THE INSTALLER OF PATCH 4
+13 ;WE NEED TO SKIP THE RESEND SESSION IF THIS IS A BETA SITE
COUNT(INSTALER) ;EP - COUNT NUMBER OF TRANSACTIONS IN SESSION LOG THAT WOULD BE PROCESSED BY THE POST INIT (BARUFEX2)
+1 NEW TEMPDUZ2,UDUZ,SESSID,TRDATE,COUNT
+2 SET COUNT=0
+3 SET TEMPDUZ2=DUZ(2)
+4 SET DUZ(2)=1
+5 FOR
SET DUZ(2)=$ORDER(^BARSESS(DUZ(2)))
IF 'DUZ(2)
QUIT
Begin DoDot:1
+6 SET UDUZ=0
+7 FOR
SET UDUZ=$ORDER(^BARSESS(DUZ(2),UDUZ))
IF 'UDUZ
QUIT
Begin DoDot:2
+8 IF $GET(INSTALER)
IF UDUZ=INSTALER
QUIT
+9 SET SESSID=0
+10 FOR
SET SESSID=$ORDER(^BARSESS(DUZ(2),UDUZ,11,SESSID))
IF 'SESSID
QUIT
Begin DoDot:3
+11 SET TRDATE=0
+12 FOR
SET TRDATE=$ORDER(^BARSESS(DUZ(2),UDUZ,11,SESSID,2,TRDATE))
IF 'TRDATE
QUIT
Begin DoDot:4
+13 IF '$ORDER(^BARSESS(DUZ(2),UDUZ,11,SESSID,21,0))&('$$GET1^DIQ(90057.110102,TRDATE_","_SESSID_","_UDUZ_",",.02,"I"))
QUIT
+14 SET COUNT=COUNT+1
End DoDot:4
End DoDot:3
End DoDot:2
End DoDot:1
+15 WRITE !,COUNT
+16 SET DUZ(2)=TEMPDUZ2
+17 QUIT
+18 ;
STARTST ;EP - LETS GET A COUNT OF INDIVIDUALLY SENT TRANSACTIONS
+1 NEW TEMPDUZ2,UDUZ,SESSID,TRDATE,COUNT
+2 SET COUNT=0
+3 SET TEMPDUZ2=DUZ(2)
+4 SET DUZ(2)=1
+5 FOR
SET DUZ(2)=$ORDER(^BARSESS(DUZ(2)))
IF 'DUZ(2)
QUIT
Begin DoDot:1
+6 SET UDUZ=0
+7 FOR
SET UDUZ=$ORDER(^BARSESS(DUZ(2),UDUZ))
IF 'UDUZ
QUIT
Begin DoDot:2
+8 IF $GET(INSTALER)
IF UDUZ=INSTALER
QUIT
+9 SET SESSID=0
+10 FOR
SET SESSID=$ORDER(^BARSESS(DUZ(2),UDUZ,11,SESSID))
IF 'SESSID
QUIT
Begin DoDot:3
+11 SET TRDATE=0
+12 FOR
SET TRDATE=$ORDER(^BARSESS(DUZ(2),UDUZ,11,SESSID,2,TRDATE))
IF 'TRDATE
QUIT
Begin DoDot:4
+13 ;A/R UFMS SESSION LOG, TRANSMITTED?
IF '$$GET1^DIQ(90057.110102,TRDATE_","_SESSID_","_UDUZ_",",.02,"I")
QUIT
+14 WRITE !,UDUZ,?10,SESSID,?25,TRDATE
+15 SET COUNT=COUNT+1
End DoDot:4
End DoDot:3
End DoDot:2
End DoDot:1
+16 WRITE !,COUNT
+17 SET DUZ(2)=TEMPDUZ2
+18 QUIT