| 1 | SCMCHLR8 ;ALB/KCL - PCMM HL7 Reject Transmission Report; 22-FEB-2000 | 
|---|
| 2 | ;;5.3;Scheduling;**210**;AUG 13, 1993 | 
|---|
| 3 | ; | 
|---|
| 4 | TERPRT ; Description: Main entry point for the PCMM HL7 Reject Transmission Report. | 
|---|
| 5 | ; | 
|---|
| 6 | ;Control variables used in generating report: | 
|---|
| 7 | ; SCRP("BEGIN")=<begining of the date range for error list> | 
|---|
| 8 | ; SCRP("END")=<ending date of range> | 
|---|
| 9 | ; SCRP("SELCT")=<select 'A'->all errors or 'D'->Date Range> | 
|---|
| 10 | ; SCRP("SORT")=<used to determine sort criteria> | 
|---|
| 11 | ; SCRP("EPS")=<used to determine the error processing status> | 
|---|
| 12 | ; | 
|---|
| 13 | N SCRP | 
|---|
| 14 | ; | 
|---|
| 15 | ;Get report parameters | 
|---|
| 16 | Q:'$$SELECT(.SCRP) | 
|---|
| 17 | Q:'$$ASKRANGE(.SCRP) | 
|---|
| 18 | Q:'$$SORTBY(.SCRP) | 
|---|
| 19 | Q:'$$EPS(.SCRP) | 
|---|
| 20 | ; | 
|---|
| 21 | ;Print report | 
|---|
| 22 | I $$DEVICE() D PRINT^SCMCHLR9 | 
|---|
| 23 | ; | 
|---|
| 24 | Q | 
|---|
| 25 | ; | 
|---|
| 26 | ; | 
|---|
| 27 | DEVICE() ; Description: Allows the user to select a device. | 
|---|
| 28 | ; | 
|---|
| 29 | ;  Input: None | 
|---|
| 30 | ; | 
|---|
| 31 | ; Output: | 
|---|
| 32 | ;  Function Value - Returns 0 if the user decides not to print or | 
|---|
| 33 | ;                   to queue the report, 1 otherwise. | 
|---|
| 34 | ; | 
|---|
| 35 | N OK | 
|---|
| 36 | S OK=1 | 
|---|
| 37 | S %ZIS="MQ" | 
|---|
| 38 | D ^%ZIS | 
|---|
| 39 | S:POP OK=0 | 
|---|
| 40 | D:OK&$D(IO("Q")) | 
|---|
| 41 | .S ZTRTN="PRINT^SCMCHLR9",ZTDESC="PCMM Transmission Error REPORT",ZTSAVE("SCRP(")="" | 
|---|
| 42 | .D ^%ZTLOAD | 
|---|
| 43 | .W !,$S($D(ZTSK):"REQUEST QUEUED TASK="_ZTSK,1:"REQUEST CANCELLED") | 
|---|
| 44 | .D HOME^%ZIS | 
|---|
| 45 | .S OK=0 | 
|---|
| 46 | ; | 
|---|
| 47 | Q OK | 
|---|
| 48 | ; | 
|---|
| 49 | ; | 
|---|
| 50 | SELECT(SCRP) ; Description: Ask the user to select 'all errors' or errors for a 'date range'. | 
|---|
| 51 | ; | 
|---|
| 52 | ;  Input: None | 
|---|
| 53 | ; | 
|---|
| 54 | ; Output: | 
|---|
| 55 | ;  Function value - 1 if user selected all errors, 0 otherwise | 
|---|
| 56 | ;  SCRP("SELCT") - (pass by reference) used to return list filter | 
|---|
| 57 | ; | 
|---|
| 58 | N DIR,DTOUT,DUOUT,X,Y | 
|---|
| 59 | ; | 
|---|
| 60 | ;Ask user to select all errors or date range | 
|---|
| 61 | S DIR(0)="SMO^A:All Errors;D:Date Range" | 
|---|
| 62 | S DIR("A")="Select all errors or a date range" | 
|---|
| 63 | S DIR("?",1)="You have a choice of selecting all errors to be printed," | 
|---|
| 64 | S DIR("?")="or errors may be printed for a specified date range." | 
|---|
| 65 | D ^DIR | 
|---|
| 66 | ;Process user response | 
|---|
| 67 | Q:$D(DIRUT) 0 | 
|---|
| 68 | S SCRP("SELCT")=Y | 
|---|
| 69 | Q 1 | 
|---|
| 70 | ; | 
|---|
| 71 | ; | 
|---|
| 72 | ASKRANGE(SCRP) ; | 
|---|
| 73 | ; Description: Asks the user to enter a date range for report. | 
|---|
| 74 | ; | 
|---|
| 75 | ;If user selected ALL errors, init begin and end dates and quit | 
|---|
| 76 | I $G(SCRP("SELCT"))="A" D  Q 1 | 
|---|
| 77 | .S SCRP("BEGIN")=0 | 
|---|
| 78 | .S SCRP("END")=DT | 
|---|
| 79 | ;Otherwise, ask user for date range | 
|---|
| 80 | Q:'$$ASKBEGIN(.SCRP) 0 | 
|---|
| 81 | Q:'$$ASKEND(.SCRP) 0 | 
|---|
| 82 | Q 1 | 
|---|
| 83 | ; | 
|---|
| 84 | ; | 
|---|
| 85 | ASKBEGIN(SCRP) ; | 
|---|
| 86 | ;Description: Asks the user to enter a begin date. | 
|---|
| 87 | ; | 
|---|
| 88 | ;  Input: None | 
|---|
| 89 | ; | 
|---|
| 90 | ; Output: | 
|---|
| 91 | ;   Function value - 1 if user selected a date, 0 otherwise | 
|---|
| 92 | ;   SCRP("BEGIN")=(pass by reference) used to return date selected | 
|---|
| 93 | ; | 
|---|
| 94 | N DIR,DTOUT,DUOUT,X,Y | 
|---|
| 95 | S DIR(0)="D^::EX" | 
|---|
| 96 | S DIR("A")="Enter Beginning Date" | 
|---|
| 97 | S DIR("B")=$$FMTE^XLFDT($$FMADD^XLFDT(DT,-14),"D") | 
|---|
| 98 | S DIR("?")="Enter the first day to begin searching for PCMM Transmission Errors." | 
|---|
| 99 | REPEAT D ^DIR | 
|---|
| 100 | Q:$D(DIRUT) 0 | 
|---|
| 101 | I Y>DT W !,"Date can not be latter than today!" G REPEAT | 
|---|
| 102 | S SCRP("BEGIN")=Y | 
|---|
| 103 | Q 1 | 
|---|
| 104 | ; | 
|---|
| 105 | ; | 
|---|
| 106 | ASKEND(SCRP) ; | 
|---|
| 107 | ; Description: Asks the user to enter an end date. | 
|---|
| 108 | ; | 
|---|
| 109 | ;  Input: | 
|---|
| 110 | ;   SCRP("BEGIN") - the earliest possible date | 
|---|
| 111 | ; | 
|---|
| 112 | ; Output: | 
|---|
| 113 | ;  Function value - 1 if user selected a date, 0 otherwise | 
|---|
| 114 | ;  SCRP("END")=(pass by reference) used to return date selected | 
|---|
| 115 | ; | 
|---|
| 116 | N DIR,DTOUT,DUOUT,X,Y | 
|---|
| 117 | S DIR(0)="D^::EX" | 
|---|
| 118 | S DIR("A")="Enter Ending Date" | 
|---|
| 119 | ;S DIR("B")=$$FMTE^XLFDT(SCRP("BEGIN"),"D") | 
|---|
| 120 | S DIR("B")=$$FMTE^XLFDT(DT,"D") | 
|---|
| 121 | S DIR("?")="Enter the last day to list transmission errors for." | 
|---|
| 122 | AGAIN D ^DIR | 
|---|
| 123 | Q:$D(DIRUT) 0 | 
|---|
| 124 | I (Y<$G(SCRP("BEGIN"))) W !,"Date must not be earlier than "_DIR("B") G AGAIN | 
|---|
| 125 | S SCRP("END")=Y | 
|---|
| 126 | Q 1 | 
|---|
| 127 | ; | 
|---|
| 128 | ; | 
|---|
| 129 | SORTBY(SCRP) ; Description: Ask the user to enter a sort criteria for printing errors. | 
|---|
| 130 | ; | 
|---|
| 131 | ;  Input: None | 
|---|
| 132 | ; | 
|---|
| 133 | ; Output: | 
|---|
| 134 | ;  Function value - 1 if user selected a sort, 0 otherwise | 
|---|
| 135 | ;  SCRP("SORT") - (pass by reference) used to return sort by criteria | 
|---|
| 136 | ; | 
|---|
| 137 | N DIR,DTOUT,DUOUT,X,Y | 
|---|
| 138 | ;Ask user to select sort by criteria | 
|---|
| 139 | S DIR(0)="SMO^N:Patient Name;D:Date Error Received;P:Provider" | 
|---|
| 140 | S DIR("A")="Select sort criteria for listing PCMM Transmission Errors" | 
|---|
| 141 | S DIR("?")="Enter how the error list should be sorted by." | 
|---|
| 142 | D ^DIR | 
|---|
| 143 | ;Process user response | 
|---|
| 144 | Q:$D(DIRUT) 0 | 
|---|
| 145 | S SCRP("SORT")=Y | 
|---|
| 146 | Q 1 | 
|---|
| 147 | ; | 
|---|
| 148 | ; | 
|---|
| 149 | EPS(SCRP) ; Description: Ask user to enter a error processing status. | 
|---|
| 150 | ; | 
|---|
| 151 | ;  Input: None | 
|---|
| 152 | ; | 
|---|
| 153 | ; Output: | 
|---|
| 154 | ;  Function value - 1 if user selected an error processin status, 0 otherwise | 
|---|
| 155 | ;    SCRP("EPS") - (pass by reference) used to return Error Processing | 
|---|
| 156 | ;                  Status: 1->New, 2->Checked, 3->Both | 
|---|
| 157 | ; | 
|---|
| 158 | N DIR,DTOUT,DUOUT,X,Y | 
|---|
| 159 | ;Ask user to select error processing status | 
|---|
| 160 | S DIR(0)="SMO^1:New;2:Checked;3:Both" | 
|---|
| 161 | S DIR("A")="Select Error Processing Status" | 
|---|
| 162 | S DIR("?",1)="Enter an error processing status.  Only those errors matching" | 
|---|
| 163 | S DIR("?")="the error processing status selected will be listed." | 
|---|
| 164 | D ^DIR | 
|---|
| 165 | ;Process user response | 
|---|
| 166 | Q:$D(DIRUT) 0 | 
|---|
| 167 | S SCRP("EPS")=+Y | 
|---|
| 168 | Q 1 | 
|---|