ACKQPCE ;HCIOFO/AG - Quasar PCE Interface; August 1999.
 ;;3.0;QUASAR;;Feb 11, 2000
 ;;
 ; this routine contains the entry points for sending a Quasar visit
 ;  to PCE, and deleting a Quasar visit from PCE.
 ; the entry points are :-
 ;   SENDPCE(ACKVIEN,ACKPKG,ACKSRC,ACKDATE) ; send a visit
 ; & KILLPCE(ACKVIEN) ; kill a visit from PCE
 ;
SENDPCE(ACKVIEN,ACKPKG,ACKSRC) ; send a visit to pce
 ; requires :-
 ;   ACKVIEN - Quasar visit ien (from 509850.6) (reqd)
 ;   ACKPKG  - package number for Quasar from package file (9.4) (opt)
 ;   ACKSRC  - source name (free text) (opt)
 ; returns :-
 ;     1  -  visit processed ok (no errors)
 ;     0  -  visit not processed (errors found)
 ; briefly, this routine does the following :-
 ;   (code for this function is in ^ACKQPCE1)
 ;  .lock the visit
 ;  .retrieve all the visit data
 ;  .if the visit already exists in PCE...
 ;  ..remove all workload from the PCE visit
 ;  ..if workload not removed ok...
 ;  ...record error on Qsr Visit file
 ;  ...unlock visit
 ;  ...end processing - return 0
 ;  .create temp file containing visit data in format reqd by
 ;    PCE api DATA2PCE^PXAPI
 ;  .call the PCE api to update the PCE Visit file
 ;  .if PCE api returned an error...
 ;  ..record error on Qsr Visit file
 ;  ..unlock visit
 ;  ..end processing - return 0
 ;  .update visit fields
 ;  .unlock visit
 ;  .end processing - return 1
 I +$G(ACKVIEN)=0 Q 0
 I $G(ACKPKG)="" S ACKPKG=$$PKG
 I $G(ACKSRC)="" S ACKSRC=$$SRC
 Q $$SENDPCE^ACKQPCE1(ACKVIEN,ACKPKG,ACKSRC)
 ;
KILLPCE(ACKVIEN) ; remove a Quasar Visit from PCE
 ; requires:-
 ;    ACKVIEN - Quasar Visit ien (from 509850.6) (reqd)
 ; returns:-
 ;    0 - unable to process, error returned by PCE
 ;    1 - visit deleted successfully
 ; this routine does the following :-
 ;   .get the PCE ien for the visit
 ;   .if no PCE ien then exit (return 1)
 ;   .lock the visit
 ;   .call the PCE API DELVFILE^PXAPI to delete the visit
 ;   .if error returned by PCE...
 ;   ..record error on Qsr Visit file
 ;   ..file Last Edited in Qsr date (to create Exception entry)
 ;   ..end processing - return 0
 ;   .update visit fields
 ;   .unlock visit
 ;   .end processing - return 1
 I +$G(ACKVIEN)=0 Q 0
 Q $$KILLPCE^ACKQPCE3(ACKVIEN)
 ;
PKG() ; determine Quasar package number
 N ACKTGT
 D FIND^DIC(9.4,"",.01,"X","QUASAR",1,"B","","","ACKTGT","")
 Q +$G(ACKTGT("DILIST",2,1))
 ;
SRC() ; return default source string for quasar/pce interface
 Q "QUASAR"
 ;
CLEAR(ACKVIEN) ; clear the PCE Error multiple for a Quasar visit
 N ACKTGT,ACKI,ACKARR
 ; get all the current sub file entries
 D LIST^DIC(509850.65,","_ACKVIEN_",",.01,"","*","","","","","","ACKTGT","")
 ; transfer them to an FDA format array for update
 F ACKI=1:1 Q:'$D(ACKTGT("DILIST",2,ACKI))  D
 . S ACKSUB=ACKTGT("DILIST",2,ACKI)
 . S ACKARR(509850.65,ACKSUB_","_ACKVIEN_",",.01)="@"
 ; now update the file
 D FILE^DIE("","ACKARR","")
 ; done
 Q
 ;
FILERSN(ACKVIEN,ACKRSN) ; file PCE Errors on Quasar visit file 509850.6
 ; requires :- ACKVIEN - quasar visit number
 ;             ACKRSN  - array containing the errors
 N ACKI,ACKARR
 F ACKI=1:1:ACKRSN D
 . S ACKARR(509850.65,"+"_ACKI_","_ACKVIEN_",",.01)=ACKI
 . S ACKARR(509850.65,"+"_ACKI_","_ACKVIEN_",",.02)=$P(ACKRSN(ACKI,0),U,2)
 . S ACKARR(509850.65,"+"_ACKI_","_ACKVIEN_",",.03)=$P(ACKRSN(ACKI,0),U,3)
 . S ACKARR(509850.65,"+"_ACKI_","_ACKVIEN_",",.04)=$P(ACKRSN(ACKI,0),U,4)
 . S ACKARR(509850.65,"+"_ACKI_","_ACKVIEN_",",1)=ACKRSN(ACKI,1)
 D UPDATE^DIE("","ACKARR","","")
 ; done
 Q
 ;
 
--- Routine Detail   --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HACKQPCE   3614     printed  Sep 23, 2025@20:08:44                                                                                                                                                                                                     Page 2
ACKQPCE   ;HCIOFO/AG - Quasar PCE Interface; August 1999.
 +1       ;;3.0;QUASAR;;Feb 11, 2000
 +2       ;;
 +3       ; this routine contains the entry points for sending a Quasar visit
 +4       ;  to PCE, and deleting a Quasar visit from PCE.
 +5       ; the entry points are :-
 +6       ;   SENDPCE(ACKVIEN,ACKPKG,ACKSRC,ACKDATE) ; send a visit
 +7       ; & KILLPCE(ACKVIEN) ; kill a visit from PCE
 +8       ;
SENDPCE(ACKVIEN,ACKPKG,ACKSRC) ; send a visit to pce
 +1       ; requires :-
 +2       ;   ACKVIEN - Quasar visit ien (from 509850.6) (reqd)
 +3       ;   ACKPKG  - package number for Quasar from package file (9.4) (opt)
 +4       ;   ACKSRC  - source name (free text) (opt)
 +5       ; returns :-
 +6       ;     1  -  visit processed ok (no errors)
 +7       ;     0  -  visit not processed (errors found)
 +8       ; briefly, this routine does the following :-
 +9       ;   (code for this function is in ^ACKQPCE1)
 +10      ;  .lock the visit
 +11      ;  .retrieve all the visit data
 +12      ;  .if the visit already exists in PCE...
 +13      ;  ..remove all workload from the PCE visit
 +14      ;  ..if workload not removed ok...
 +15      ;  ...record error on Qsr Visit file
 +16      ;  ...unlock visit
 +17      ;  ...end processing - return 0
 +18      ;  .create temp file containing visit data in format reqd by
 +19      ;    PCE api DATA2PCE^PXAPI
 +20      ;  .call the PCE api to update the PCE Visit file
 +21      ;  .if PCE api returned an error...
 +22      ;  ..record error on Qsr Visit file
 +23      ;  ..unlock visit
 +24      ;  ..end processing - return 0
 +25      ;  .update visit fields
 +26      ;  .unlock visit
 +27      ;  .end processing - return 1
 +28       IF +$GET(ACKVIEN)=0
               QUIT 0
 +29       IF $GET(ACKPKG)=""
               SET ACKPKG=$$PKG
 +30       IF $GET(ACKSRC)=""
               SET ACKSRC=$$SRC
 +31       QUIT $$SENDPCE^ACKQPCE1(ACKVIEN,ACKPKG,ACKSRC)
 +32      ;
KILLPCE(ACKVIEN) ; remove a Quasar Visit from PCE
 +1       ; requires:-
 +2       ;    ACKVIEN - Quasar Visit ien (from 509850.6) (reqd)
 +3       ; returns:-
 +4       ;    0 - unable to process, error returned by PCE
 +5       ;    1 - visit deleted successfully
 +6       ; this routine does the following :-
 +7       ;   .get the PCE ien for the visit
 +8       ;   .if no PCE ien then exit (return 1)
 +9       ;   .lock the visit
 +10      ;   .call the PCE API DELVFILE^PXAPI to delete the visit
 +11      ;   .if error returned by PCE...
 +12      ;   ..record error on Qsr Visit file
 +13      ;   ..file Last Edited in Qsr date (to create Exception entry)
 +14      ;   ..end processing - return 0
 +15      ;   .update visit fields
 +16      ;   .unlock visit
 +17      ;   .end processing - return 1
 +18       IF +$GET(ACKVIEN)=0
               QUIT 0
 +19       QUIT $$KILLPCE^ACKQPCE3(ACKVIEN)
 +20      ;
PKG()     ; determine Quasar package number
 +1        NEW ACKTGT
 +2        DO FIND^DIC(9.4,"",.01,"X","QUASAR",1,"B","","","ACKTGT","")
 +3        QUIT +$GET(ACKTGT("DILIST",2,1))
 +4       ;
SRC()     ; return default source string for quasar/pce interface
 +1        QUIT "QUASAR"
 +2       ;
CLEAR(ACKVIEN) ; clear the PCE Error multiple for a Quasar visit
 +1        NEW ACKTGT,ACKI,ACKARR
 +2       ; get all the current sub file entries
 +3        DO LIST^DIC(509850.65,","_ACKVIEN_",",.01,"","*","","","","","","ACKTGT","")
 +4       ; transfer them to an FDA format array for update
 +5        FOR ACKI=1:1
               if '$DATA(ACKTGT("DILIST",2,ACKI))
                   QUIT 
               Begin DoDot:1
 +6                SET ACKSUB=ACKTGT("DILIST",2,ACKI)
 +7                SET ACKARR(509850.65,ACKSUB_","_ACKVIEN_",",.01)="@"
               End DoDot:1
 +8       ; now update the file
 +9        DO FILE^DIE("","ACKARR","")
 +10      ; done
 +11       QUIT 
 +12      ;
FILERSN(ACKVIEN,ACKRSN) ; file PCE Errors on Quasar visit file 509850.6
 +1       ; requires :- ACKVIEN - quasar visit number
 +2       ;             ACKRSN  - array containing the errors
 +3        NEW ACKI,ACKARR
 +4        FOR ACKI=1:1:ACKRSN
               Begin DoDot:1
 +5                SET ACKARR(509850.65,"+"_ACKI_","_ACKVIEN_",",.01)=ACKI
 +6                SET ACKARR(509850.65,"+"_ACKI_","_ACKVIEN_",",.02)=$PIECE(ACKRSN(ACKI,0),U,2)
 +7                SET ACKARR(509850.65,"+"_ACKI_","_ACKVIEN_",",.03)=$PIECE(ACKRSN(ACKI,0),U,3)
 +8                SET ACKARR(509850.65,"+"_ACKI_","_ACKVIEN_",",.04)=$PIECE(ACKRSN(ACKI,0),U,4)
 +9                SET ACKARR(509850.65,"+"_ACKI_","_ACKVIEN_",",1)=ACKRSN(ACKI,1)
               End DoDot:1
 +10       DO UPDATE^DIE("","ACKARR","","")
 +11      ; done
 +12       QUIT 
 +13      ;