- PSARDCRP ;BIRM/JMC - Return Drug Credit Report User Input Parameter ;06/04/08
- ;;3.0;DRUG ACCOUNTABILITY/INVENTORY INTERFACE;**69**;10/24/97;Build 9
- ;
- I '$$CHKEY^PSARDCUT() Q
- N DIR,DIRUT,DUOUT,DTOUT,PSAPHLOC,PSADTRNG,PSARDRBD,PSARDRED,PSABASTS
- N PSARDRT,PSAEXCEL
- ; - Pharmacy location selection
- S PSAPHLOC=$$PHLOC^PSARDCUT() I PSAPHLOC=""!($D(DIRUT)) Q
- ;
- ; - Date range selection
- W ! S PSADTRNG=$$DTRNG^PSARDCUT("T-90","T") I PSADTRNG="^"!($D(DIRUT)) Q
- S PSARDRBD=$P(PSADTRNG,"^"),PSARDRED=$P(PSADTRNG,"^",2)
- ;
- ; - Return drug credit status selection
- W ! S PSABASTS=$$STASEL^PSARDCUT() I PSABASTS=""!($D(DIRUT)) Q
- I PSABASTS="ALL" S PSABASTS="AP,PU,CA,CO"
- ;
- ; - Report type selection
- W ! S PSARDRTP=$$DETSUM() I PSARDRTP=""!($D(DIRUT)) Q
- ;
- ; - Export to Spreadsheet
- W ! S PSAEXCEL=$$EXCEL^PSARDCUT() I PSAEXCEL=""!(PSAEXCEL="^")!($D(DIRUT)) Q
- ;
- DEVICE ; - Select Device
- W ! K %ZIS,IOP,POP,ZTSK S %ZIS="QM" D ^%ZIS I POP D D EXIT Q
- . W !!,"No device selected. Exiting...",!! S DIR(0)="E" W ! D ^DIR K DIR
- I $D(IO("Q")) D D EXIT Q
- . N G K ZTIO,ZTSAVE,ZTDTH,ZTSK
- . S ZTRTN=$S(PSARDRTP="S":"^PSARDCRS",1:"^PSARDCRD"),ZTDESC="Returned Drug Credit Report"_$S(PSARDRTP="S":"(Summary)",1:" (Detailed")
- . F G="PSAPHLOC","PSARDRBD","PSARDRED","PSABASTS","PSARDCMF","PSARDRTP","PSAEXCEL" S ZTSAVE(G)=""
- . D ^%ZTLOAD
- . I $D(ZTSK) W !,"Report is Queued to print as Task #: ",ZTSK,!! S DIR(0)="E" W ! D ^DIR K DIR Q
- ; - Determine which report routine to call based on report type selected.
- I $G(PSARDRTP)="S" D ^PSARDCRS
- I $G(PSARDRTP)="D" D ^PSARDCRD
- Q:$D(DIRUT)!($D(DUOUT))
- I $E(IOST)="C" K DIR S DIR(0)="E" D ^DIR K DIR
- D EXIT
- Q
- ;
- EXIT I IO'=IO(0) D ^%ZISC
- K IO("Q"),ZTSK,%ZIS,ZTIO,ZTSAVE,ZTDTH,Y,X
- Q
- DETSUM() ; Detailed or Summary report type selection.
- K DIR S DIR(0)="SA^D:DETAILED;S:SUMMARY;",DIR("A")="REPORT TYPE: ",DIR("B")="SUMMARY"
- S DIR("?")="Enter 'D' to print a detailed report or 'S' for a summary report" D ^DIR K DIR
- I $D(DIRUT) Q ""
- Q Y
- ;
- --- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HPSARDCRP 2043 printed Feb 18, 2025@23:16:48 Page 2
- PSARDCRP ;BIRM/JMC - Return Drug Credit Report User Input Parameter ;06/04/08
- +1 ;;3.0;DRUG ACCOUNTABILITY/INVENTORY INTERFACE;**69**;10/24/97;Build 9
- +2 ;
- +3 IF '$$CHKEY^PSARDCUT()
- QUIT
- +4 NEW DIR,DIRUT,DUOUT,DTOUT,PSAPHLOC,PSADTRNG,PSARDRBD,PSARDRED,PSABASTS
- +5 NEW PSARDRT,PSAEXCEL
- +6 ; - Pharmacy location selection
- +7 SET PSAPHLOC=$$PHLOC^PSARDCUT()
- IF PSAPHLOC=""!($DATA(DIRUT))
- QUIT
- +8 ;
- +9 ; - Date range selection
- +10 WRITE !
- SET PSADTRNG=$$DTRNG^PSARDCUT("T-90","T")
- IF PSADTRNG="^"!($DATA(DIRUT))
- QUIT
- +11 SET PSARDRBD=$PIECE(PSADTRNG,"^")
- SET PSARDRED=$PIECE(PSADTRNG,"^",2)
- +12 ;
- +13 ; - Return drug credit status selection
- +14 WRITE !
- SET PSABASTS=$$STASEL^PSARDCUT()
- IF PSABASTS=""!($DATA(DIRUT))
- QUIT
- +15 IF PSABASTS="ALL"
- SET PSABASTS="AP,PU,CA,CO"
- +16 ;
- +17 ; - Report type selection
- +18 WRITE !
- SET PSARDRTP=$$DETSUM()
- IF PSARDRTP=""!($DATA(DIRUT))
- QUIT
- +19 ;
- +20 ; - Export to Spreadsheet
- +21 WRITE !
- SET PSAEXCEL=$$EXCEL^PSARDCUT()
- IF PSAEXCEL=""!(PSAEXCEL="^")!($DATA(DIRUT))
- QUIT
- +22 ;
- DEVICE ; - Select Device
- +1 WRITE !
- KILL %ZIS,IOP,POP,ZTSK
- SET %ZIS="QM"
- DO ^%ZIS
- IF POP
- Begin DoDot:1
- +2 WRITE !!,"No device selected. Exiting...",!!
- SET DIR(0)="E"
- WRITE !
- DO ^DIR
- KILL DIR
- End DoDot:1
- DO EXIT
- QUIT
- +3 IF $DATA(IO("Q"))
- Begin DoDot:1
- +4 NEW G
- KILL ZTIO,ZTSAVE,ZTDTH,ZTSK
- +5 SET ZTRTN=$SELECT(PSARDRTP="S":"^PSARDCRS",1:"^PSARDCRD")
- SET ZTDESC="Returned Drug Credit Report"_$SELECT(PSARDRTP="S":"(Summary)",1:" (Detailed")
- +6 FOR G="PSAPHLOC","PSARDRBD","PSARDRED","PSABASTS","PSARDCMF","PSARDRTP","PSAEXCEL"
- SET ZTSAVE(G)=""
- +7 DO ^%ZTLOAD
- +8 IF $DATA(ZTSK)
- WRITE !,"Report is Queued to print as Task #: ",ZTSK,!!
- SET DIR(0)="E"
- WRITE !
- DO ^DIR
- KILL DIR
- QUIT
- End DoDot:1
- DO EXIT
- QUIT
- +9 ; - Determine which report routine to call based on report type selected.
- +10 IF $GET(PSARDRTP)="S"
- DO ^PSARDCRS
- +11 IF $GET(PSARDRTP)="D"
- DO ^PSARDCRD
- +12 if $DATA(DIRUT)!($DATA(DUOUT))
- QUIT
- +13 IF $EXTRACT(IOST)="C"
- KILL DIR
- SET DIR(0)="E"
- DO ^DIR
- KILL DIR
- +14 DO EXIT
- +15 QUIT
- +16 ;
- EXIT IF IO'=IO(0)
- DO ^%ZISC
- +1 KILL IO("Q"),ZTSK,%ZIS,ZTIO,ZTSAVE,ZTDTH,Y,X
- +2 QUIT
- DETSUM() ; Detailed or Summary report type selection.
- +1 KILL DIR
- SET DIR(0)="SA^D:DETAILED;S:SUMMARY;"
- SET DIR("A")="REPORT TYPE: "
- SET DIR("B")="SUMMARY"
- +2 SET DIR("?")="Enter 'D' to print a detailed report or 'S' for a summary report"
- DO ^DIR
- KILL DIR
- +3 IF $DATA(DIRUT)
- QUIT ""
- +4 QUIT Y
- +5 ;