| 1 | ACKQPCE ;HCIOFO/AG - Quasar PCE Interface; August 1999. | 
|---|
| 2 | ;;3.0;QUASAR;;Feb 11, 2000 | 
|---|
| 3 | ;; | 
|---|
| 4 | ; this routine contains the entry points for sending a Quasar visit | 
|---|
| 5 | ;  to PCE, and deleting a Quasar visit from PCE. | 
|---|
| 6 | ; the entry points are :- | 
|---|
| 7 | ;   SENDPCE(ACKVIEN,ACKPKG,ACKSRC,ACKDATE) ; send a visit | 
|---|
| 8 | ; & KILLPCE(ACKVIEN) ; kill a visit from PCE | 
|---|
| 9 | ; | 
|---|
| 10 | SENDPCE(ACKVIEN,ACKPKG,ACKSRC) ; send a visit to pce | 
|---|
| 11 | ; requires :- | 
|---|
| 12 | ;   ACKVIEN - Quasar visit ien (from 509850.6) (reqd) | 
|---|
| 13 | ;   ACKPKG  - package number for Quasar from package file (9.4) (opt) | 
|---|
| 14 | ;   ACKSRC  - source name (free text) (opt) | 
|---|
| 15 | ; returns :- | 
|---|
| 16 | ;     1  -  visit processed ok (no errors) | 
|---|
| 17 | ;     0  -  visit not processed (errors found) | 
|---|
| 18 | ; briefly, this routine does the following :- | 
|---|
| 19 | ;   (code for this function is in ^ACKQPCE1) | 
|---|
| 20 | ;  .lock the visit | 
|---|
| 21 | ;  .retrieve all the visit data | 
|---|
| 22 | ;  .if the visit already exists in PCE... | 
|---|
| 23 | ;  ..remove all workload from the PCE visit | 
|---|
| 24 | ;  ..if workload not removed ok... | 
|---|
| 25 | ;  ...record error on Qsr Visit file | 
|---|
| 26 | ;  ...unlock visit | 
|---|
| 27 | ;  ...end processing - return 0 | 
|---|
| 28 | ;  .create temp file containing visit data in format reqd by | 
|---|
| 29 | ;    PCE api DATA2PCE^PXAPI | 
|---|
| 30 | ;  .call the PCE api to update the PCE Visit file | 
|---|
| 31 | ;  .if PCE api returned an error... | 
|---|
| 32 | ;  ..record error on Qsr Visit file | 
|---|
| 33 | ;  ..unlock visit | 
|---|
| 34 | ;  ..end processing - return 0 | 
|---|
| 35 | ;  .update visit fields | 
|---|
| 36 | ;  .unlock visit | 
|---|
| 37 | ;  .end processing - return 1 | 
|---|
| 38 | I +$G(ACKVIEN)=0 Q 0 | 
|---|
| 39 | I $G(ACKPKG)="" S ACKPKG=$$PKG | 
|---|
| 40 | I $G(ACKSRC)="" S ACKSRC=$$SRC | 
|---|
| 41 | Q $$SENDPCE^ACKQPCE1(ACKVIEN,ACKPKG,ACKSRC) | 
|---|
| 42 | ; | 
|---|
| 43 | KILLPCE(ACKVIEN) ; remove a Quasar Visit from PCE | 
|---|
| 44 | ; requires:- | 
|---|
| 45 | ;    ACKVIEN - Quasar Visit ien (from 509850.6) (reqd) | 
|---|
| 46 | ; returns:- | 
|---|
| 47 | ;    0 - unable to process, error returned by PCE | 
|---|
| 48 | ;    1 - visit deleted successfully | 
|---|
| 49 | ; this routine does the following :- | 
|---|
| 50 | ;   .get the PCE ien for the visit | 
|---|
| 51 | ;   .if no PCE ien then exit (return 1) | 
|---|
| 52 | ;   .lock the visit | 
|---|
| 53 | ;   .call the PCE API DELVFILE^PXAPI to delete the visit | 
|---|
| 54 | ;   .if error returned by PCE... | 
|---|
| 55 | ;   ..record error on Qsr Visit file | 
|---|
| 56 | ;   ..file Last Edited in Qsr date (to create Exception entry) | 
|---|
| 57 | ;   ..end processing - return 0 | 
|---|
| 58 | ;   .update visit fields | 
|---|
| 59 | ;   .unlock visit | 
|---|
| 60 | ;   .end processing - return 1 | 
|---|
| 61 | I +$G(ACKVIEN)=0 Q 0 | 
|---|
| 62 | Q $$KILLPCE^ACKQPCE3(ACKVIEN) | 
|---|
| 63 | ; | 
|---|
| 64 | PKG() ; determine Quasar package number | 
|---|
| 65 | N ACKTGT | 
|---|
| 66 | D FIND^DIC(9.4,"",.01,"X","QUASAR",1,"B","","","ACKTGT","") | 
|---|
| 67 | Q +$G(ACKTGT("DILIST",2,1)) | 
|---|
| 68 | ; | 
|---|
| 69 | SRC() ; return default source string for quasar/pce interface | 
|---|
| 70 | Q "QUASAR" | 
|---|
| 71 | ; | 
|---|
| 72 | CLEAR(ACKVIEN) ; clear the PCE Error multiple for a Quasar visit | 
|---|
| 73 | N ACKTGT,ACKI,ACKARR | 
|---|
| 74 | ; get all the current sub file entries | 
|---|
| 75 | D LIST^DIC(509850.65,","_ACKVIEN_",",.01,"","*","","","","","","ACKTGT","") | 
|---|
| 76 | ; transfer them to an FDA format array for update | 
|---|
| 77 | F ACKI=1:1 Q:'$D(ACKTGT("DILIST",2,ACKI))  D | 
|---|
| 78 | . S ACKSUB=ACKTGT("DILIST",2,ACKI) | 
|---|
| 79 | . S ACKARR(509850.65,ACKSUB_","_ACKVIEN_",",.01)="@" | 
|---|
| 80 | ; now update the file | 
|---|
| 81 | D FILE^DIE("","ACKARR","") | 
|---|
| 82 | ; done | 
|---|
| 83 | Q | 
|---|
| 84 | ; | 
|---|
| 85 | FILERSN(ACKVIEN,ACKRSN) ; file PCE Errors on Quasar visit file 509850.6 | 
|---|
| 86 | ; requires :- ACKVIEN - quasar visit number | 
|---|
| 87 | ;             ACKRSN  - array containing the errors | 
|---|
| 88 | N ACKI,ACKARR | 
|---|
| 89 | F ACKI=1:1:ACKRSN D | 
|---|
| 90 | . S ACKARR(509850.65,"+"_ACKI_","_ACKVIEN_",",.01)=ACKI | 
|---|
| 91 | . S ACKARR(509850.65,"+"_ACKI_","_ACKVIEN_",",.02)=$P(ACKRSN(ACKI,0),U,2) | 
|---|
| 92 | . S ACKARR(509850.65,"+"_ACKI_","_ACKVIEN_",",.03)=$P(ACKRSN(ACKI,0),U,3) | 
|---|
| 93 | . S ACKARR(509850.65,"+"_ACKI_","_ACKVIEN_",",.04)=$P(ACKRSN(ACKI,0),U,4) | 
|---|
| 94 | . S ACKARR(509850.65,"+"_ACKI_","_ACKVIEN_",",1)=ACKRSN(ACKI,1) | 
|---|
| 95 | D UPDATE^DIE("","ACKARR","","") | 
|---|
| 96 | ; done | 
|---|
| 97 | Q | 
|---|
| 98 | ; | 
|---|