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

BARUFCLR.m

Go to the documentation of this file.
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