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

IBTASDBUTL.m

Go to the documentation of this file.
IBTASDBUTL ;EDE/TPF - UTILITY APIS FOR VTU VISTA TABLE UTILITY 
 ;;2.0;INTEGRATED BILLING;**742**;;Build 36
 ;;Per VA Directive 6402, this routine should not be modified.
 ;
 Q
 ;
 ;K POSTFDA,PUTFDA D CONVERTTOFDA^IBTASDBUTL(.ARG,.POSTFDA,.PUTFDA)
CONVERTTOFDA(ARRAY,POSTFDA,PUTFDA,FDAERROR) ;EP -
 N CHANGTYPE,FILENUM,FIELD,FIELDNUM,RECNUM,RECORDSEQ,SUBSCRIPT,VALUE
 ;
 ;ARRAY WILL BE A SIMPLE ONE SUBCRIPTED ARRAY. THE SUBSCRIPT IS A
 ;'FUSION' OF THE FILENUMBER, 'RECORD NUMBER' AND FIELD NUMBER
 ;THE RESULTANT PUTFDA AND ADDFDA IS A PSEUDO FDA ARRAY AND 
 ;
 S SUBSCRIPT=""
 F RECNUM=1:1 S SUBSCRIPT=$O(ARRAY(SUBSCRIPT)) Q:SUBSCRIPT=""  D
 .S FIELDNUM=$$LOW^XLFSTR($P(SUBSCRIPT,"_",3))
 .I FIELDNUM="-changetype" S CHANGTYPE=$$UP^XLFSTR(ARRAY(SUBSCRIPT)) Q
 .I FIELDNUM="-filenumber" Q
 .S FILENUM=$P(SUBSCRIPT,"_")
 .S RECORDSEQ=$P(SUBSCRIPT,"_",2)
 .S VALUE=$G(ARRAY(SUBSCRIPT))
 .I '$$ISFILE^IBTASDBUTL(FILENUM) D  Q
 ..;
 ..S FDAERROR("0^fda_errors",RECORDSEQ,"ARG array record")=$G(RECORDSEQ)
 ..S VALUE=$S($G(VALUE)=+$G(VALUE):$G(VALUE),1:""""_$G(VALUE)_"""")
 ..S FDAERROR("0^fda_errors",RECORDSEQ,".01")=$G(VALUE)
 ..;S FILENUM=$S($G(FILENUM)=+$G(FILENUM):$G(FILENUM),1:""""_$G(FILENUM)_"""")
 ..S FDAERROR("0^fda_errors",RECORDSEQ,"error_message")="File "_$G(FILENUM)_" does NOT exist! Cannot create FDA array"
 .;
 .;ADD API CHECK FOR VALID CHANGETYPE VALUES - SCREENED BY  TAS-api?
 .I CHANGTYPE="A" S POSTFDA(FILENUM,RECORDSEQ,FIELDNUM)=VALUE Q
 .I CHANGTYPE="M" S PUTFDA(FILENUM,RECORDSEQ,FIELDNUM)=VALUE Q
 .;
 .I SUBSCRIPT[(".01") D
 ..S FDAERROR("0^fda_errors",RECORDSEQ,"ARG array record")=$G(RECORDSEQ)
 ..S FDAERROR("0^fda_errors",RECORDSEQ,"-changetype")=""""_$G(CHANGTYPE)_""""
 ..S FDAERROR("0^fda_errors",RECORDSEQ,".01")=$G(ARG(SUBSCRIPT))
 ..S FDAERROR("0^fda_errors",RECORDSEQ,"error_message")="Unknown CHANGTYPE found in -changetype field. Cannot determine API call."
 ;
 Q
 ;
ISFILE(FILENUM) ;EP - DOES FILE EXIST?
 Q $D(^DIC(FILENUM,0))
 ;
LKPFLAGS(FLAGS,FILENUM,ARGRECORD,TARGET,ARG,FINDRES) ;EP - ANALYZE FILE AND RETURN APPROPRIATE FLAGS AND TARGET
 N FILEIEN,FIELDNUM,KEYSEQ,SUB
 ;
 I '$D(^DD("KEY","B",FILENUM)) D  Q  ;IF NO KEY UNIQUE INDEX THEN SIMPLELOOKUP ON STANDARD X-REFS?
 .S FLAGS="MOX"
 .S TARGET=$G(ARG(FILENUM,ARGRECORD,.01))
 ;
 ;CHECK KEY FILE
 I $D(^DD("KEY","B",FILENUM)) D  Q
 .S FLAGS="K"
 .S FILEIEN=$O(^DD("KEY","B",FILENUM,""))
 .S KEYSEQ=0
 .F  S KEYSEQ=$O(^DD("KEY",FILEIEN,2,"S",KEYSEQ)) Q:'KEYSEQ  D
 ..S FIELDNUM=$O(^DD("KEY",FILEIEN,2,"S",KEYSEQ,""))
 ..S TARGET(KEYSEQ)=$G(ARG(FILENUM,ARGRECORD,FIELDNUM))
 ..I TARGET(KEYSEQ)="" D
 ...S FINDRES("0^find_error",ARGRECORD,"ARG array record")=$G(ARGRECORD)
 ...S FINDRES("0^find_errors",ARGRECORD,KEYSEQ)=$G(FIELDNUM)
 ...S FINDRES("0^find_errors",ARGRECORD,"error_message")="ARG record missing KEY unique index values needed."  ;DON'T NEED FM API WILL KNOW THIS, BUT THIS WILL REPORT FIELDS MISSING
 Q