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

BPSTASDB.m

Go to the documentation of this file.
  1. BPSTASDB ;AITC/PD - ECME TAS BPSTL Utility; 12/16/2019
  1. ;;1.0;E CLAIMS MGMT ENGINE;**27**;JUN 2004;Build 15
  1. ;;Per VA Directive 6402, this routine should not be modified.
  1. ;
  1. Q
  1. ;
  1. ; RPC to reset or add entries to the queue used for
  1. ; transmitting claims to TAS. Queue = ^BPSTL("C")
  1. ; Database: BPS LOG OF TRANSACTIONS (#9002313.57)
  1. ; Field: MCCF EDI TAS PROGRESS (#20)
  1. ;
  1. ; Inputs: FLAG (Required)
  1. ; 1 = Reset Existing Entries to 1
  1. ; 2 = Add New Entries
  1. ; DATE (optional)
  1. ; Date to be used if input parameter FLAG = 2 (ADD)
  1. ; Starting date for adding new entries to the queue
  1. ;
  1. EN(RESULT,ARGS) ; RPC Entry Point
  1. ;
  1. N BPSDATE,BPSFLAG,COUNT
  1. K RESULT
  1. ;
  1. S BPSFLAG=$G(ARGS("FLAG"))
  1. I BPSFLAG="" S COUNT=-1 G RESULT
  1. I (BPSFLAG'=1)&(BPSFLAG'=2) S COUNT=-3 G RESULT
  1. S BPSDATE=$G(ARGS("DATE"))
  1. I BPSFLAG=2,$G(BPSDATE)="" S COUNT=-1 G RESULT
  1. ;
  1. S COUNT=0
  1. I BPSFLAG=1 D RESET
  1. I BPSFLAG=2 D ADD(BPSDATE)
  1. ;
  1. RESULT ; setup JSON result
  1. ; Result will return variable COUNT
  1. ; COUNT = # of records reset or added
  1. ; COUNT = -1 indicates an input parameter was missing
  1. ; COUNT = -2 indicates the date passed in for ADD was invalid
  1. ; COUNT = -3 indicates input FLAG was not 1 or 2
  1. S RESULT(1)="[{"_"""updates"""_":"_COUNT_"}]"
  1. ;
  1. Q
  1. ;
  1. RESET ; Reset existing entries in ^BPSTL("C") to 1
  1. ; Only entries that currently have a defined value for field #20
  1. ; will be reset. Value will be reset to 1 (READY TO SEND (OPEN))
  1. ;
  1. N BPS57,BPSINDX
  1. ;
  1. S BPSINDX=1
  1. F S BPSINDX=$O(^BPSTL("C",BPSINDX)) Q:'BPSINDX D
  1. . S BPS57=0
  1. . F S BPS57=$O(^BPSTL("C",BPSINDX,BPS57)) Q:'BPS57 D
  1. . . N BPSA,BPSFN,BPSREC
  1. . . S BPSFN=9002313.57
  1. . . S BPSREC=BPS57_","
  1. . . S BPSA(BPSFN,BPSREC,20)=1
  1. . . D FILE^DIE("","BPSA","")
  1. . . S COUNT=COUNT+1
  1. Q
  1. ;
  1. ADD(BPSDATE) ; Add new entries to ^BPSTL("C")
  1. ; Using the AH index and the date passed in, add entries
  1. ; to the queue that are not already in the queue. Set
  1. ; the value to 1.
  1. ;
  1. N BPS57
  1. ;
  1. S BPSDATE=$$DATE(BPSDATE)
  1. I BPSDATE=-1 S COUNT=-2 Q
  1. ;
  1. F S BPSDATE=$O(^BPSTL("AH",BPSDATE)) Q:'BPSDATE D
  1. . S BPS57=0
  1. . F S BPS57=$O(^BPSTL("AH",BPSDATE,BPS57)) Q:'BPS57 D
  1. . . ; Don't include entries with Field #20 already set
  1. . . I $$GET1^DIQ(9002313.57,BPS57,20)'="" Q
  1. . . ; Don't include non-billable transactions
  1. . . I $$GET1^DIQ(9002313.57,BPS57,19,"I")'="N" D
  1. . . . N BPSA,BPSFN,BPSREC
  1. . . . S BPSFN=9002313.57
  1. . . . S BPSREC=BPS57_","
  1. . . . S BPSA(BPSFN,BPSREC,20)=1
  1. . . . D FILE^DIE("","BPSA","")
  1. . . . S COUNT=COUNT+1
  1. Q
  1. ;
  1. DATE(X) ; Convert Date to FileMan format
  1. ;
  1. N %DT,Y
  1. D ^%DT
  1. Q Y
  1. ;