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

PSARDCRP.m

Go to the documentation of this file.
  1. 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
  1. ;
  1. I '$$CHKEY^PSARDCUT() Q
  1. N DIR,DIRUT,DUOUT,DTOUT,PSAPHLOC,PSADTRNG,PSARDRBD,PSARDRED,PSABASTS
  1. N PSARDRT,PSAEXCEL
  1. ; - Pharmacy location selection
  1. S PSAPHLOC=$$PHLOC^PSARDCUT() I PSAPHLOC=""!($D(DIRUT)) Q
  1. ;
  1. ; - Date range selection
  1. W ! S PSADTRNG=$$DTRNG^PSARDCUT("T-90","T") I PSADTRNG="^"!($D(DIRUT)) Q
  1. S PSARDRBD=$P(PSADTRNG,"^"),PSARDRED=$P(PSADTRNG,"^",2)
  1. ;
  1. ; - Return drug credit status selection
  1. W ! S PSABASTS=$$STASEL^PSARDCUT() I PSABASTS=""!($D(DIRUT)) Q
  1. I PSABASTS="ALL" S PSABASTS="AP,PU,CA,CO"
  1. ;
  1. ; - Report type selection
  1. W ! S PSARDRTP=$$DETSUM() I PSARDRTP=""!($D(DIRUT)) Q
  1. ;
  1. ; - Export to Spreadsheet
  1. W ! S PSAEXCEL=$$EXCEL^PSARDCUT() I PSAEXCEL=""!(PSAEXCEL="^")!($D(DIRUT)) Q
  1. ;
  1. DEVICE ; - Select Device
  1. W ! K %ZIS,IOP,POP,ZTSK S %ZIS="QM" D ^%ZIS I POP D D EXIT Q
  1. . W !!,"No device selected. Exiting...",!! S DIR(0)="E" W ! D ^DIR K DIR
  1. I $D(IO("Q")) D D EXIT Q
  1. . N G K ZTIO,ZTSAVE,ZTDTH,ZTSK
  1. . S ZTRTN=$S(PSARDRTP="S":"^PSARDCRS",1:"^PSARDCRD"),ZTDESC="Returned Drug Credit Report"_$S(PSARDRTP="S":"(Summary)",1:" (Detailed")
  1. . F G="PSAPHLOC","PSARDRBD","PSARDRED","PSABASTS","PSARDCMF","PSARDRTP","PSAEXCEL" S ZTSAVE(G)=""
  1. . D ^%ZTLOAD
  1. . I $D(ZTSK) W !,"Report is Queued to print as Task #: ",ZTSK,!! S DIR(0)="E" W ! D ^DIR K DIR Q
  1. ; - Determine which report routine to call based on report type selected.
  1. I $G(PSARDRTP)="S" D ^PSARDCRS
  1. I $G(PSARDRTP)="D" D ^PSARDCRD
  1. Q:$D(DIRUT)!($D(DUOUT))
  1. I $E(IOST)="C" K DIR S DIR(0)="E" D ^DIR K DIR
  1. D EXIT
  1. Q
  1. ;
  1. EXIT I IO'=IO(0) D ^%ZISC
  1. K IO("Q"),ZTSK,%ZIS,ZTIO,ZTSAVE,ZTDTH,Y,X
  1. Q
  1. DETSUM() ; Detailed or Summary report type selection.
  1. K DIR S DIR(0)="SA^D:DETAILED;S:SUMMARY;",DIR("A")="REPORT TYPE: ",DIR("B")="SUMMARY"
  1. S DIR("?")="Enter 'D' to print a detailed report or 'S' for a summary report" D ^DIR K DIR
  1. I $D(DIRUT) Q ""
  1. Q Y
  1. ;