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

PSOFDAMG.m

Go to the documentation of this file.
  1. PSOFDAMG ;BHAM ISC/MR - FDA Medication Guide ;11/10/09 3:44pm
  1. ;;7.0;OUTPATIENT PHARMACY;**343,367**;DEC 1997;Build 62
  1. ;External reference EN^PSNFDAMG supported by DBIA 5517
  1. ;External reference ^PSDRUG supported by DBIA 221
  1. ;External reference to DEVICE file (#3.5) supported by DBIA 5718
  1. ;
  1. DISPLAY ; Display the FDA Medication Guide
  1. ; Note: RX0 is a global variable (assumed as such by most hidden actions)
  1. N DRGIEN,VAPRDIEN
  1. S DRGIEN=+$P($G(RX0),"^",6)
  1. I '$D(^PSDRUG(DRGIEN,0)) W $C(7),!,"Invalid Drug" D WAIT^VALM1 Q
  1. S VAPRDIEN=+$P($G(^PSDRUG(DRGIEN,"ND")),"^",3)
  1. I 'VAPRDIEN W $C(7),!!,$$GET1^DIQ(50,DRGIEN,.01)_" not matched to the National Drug File (NDF)" D WAIT^VALM1 Q
  1. ;
  1. D FULL^VALM1 D EN^PSNFDAMG(VAPRDIEN)
  1. Q
  1. ;
  1. PRINTMG(RXIEN,PRINTER) ; This API is used to automatically print FDA Med Guides along with Rx labels.
  1. ; Input: (r) RXIEN - Pointer to the DRUG file (#50)
  1. ; (r) PRINTER - Windows Printer Network Name (e.g., '\\vhaistfpc4\IST-HP4525-1')
  1. ;
  1. ;Output: ERROR (2 pieces)
  1. ; P1 - 0: Success / 1:Error
  1. ; P2 - Error Message (when P1 = 1) (e.g. "No FDA Med Guide on file", "Invalid Printer Name", etc.)
  1. ;
  1. N PRTSVURL,FDAMGURL,FDAMGFN,STATUS,RXNUM,PATNAM
  1. ;
  1. I '$$MGONFILE^PSOFDAUT(RXIEN) Q "1^No FDA Med Guide Available"
  1. I $G(PRINTER)="" Q "1^Invalid Printer"
  1. I $$GET1^DIQ(59,PSOSITE,134)="" Q "1^FDA Med Guide automatic printing functionality turned OFF"
  1. ;
  1. ; Concatenating/Encoding the Web Server URL to the FDA Med Guide file name
  1. S FDAMGFN=$P($$MGONFILE^PSOFDAUT(RXIEN),"^",2)
  1. S RXNUM=$$GET1^DIQ(52,RXIEN,.01)
  1. S PATNAM=$$GET1^DIQ(52,RXIEN,2)
  1. S FDAMGURL=$$ENCODE^XTHCURL($$GET1^DIQ(59.7,1,100)_FDAMGFN_"^"_RXNUM_"^"_PATNAM_"^"_PRINTER_"^")
  1. ;
  1. S PRTSVURL=$$GET1^DIQ(59,PSOSITE,134)_"Eep9qUmT="
  1. ;
  1. ;Invoking Kernel HTTP Toolkit
  1. S STATUS=$$GETURL^XTHC10(PRTSVURL_FDAMGURL,30)
  1. I (+STATUS'=200) Q "1^"_$P(STATUS,"^",2)
  1. ;
  1. Q 0
  1. ;
  1. REPRTMG ; Entry point for Reprint FDA Medication Guide
  1. ; Note: The PSOSITE variable is assumed to be set with the Pharmacy Division IEN
  1. ;
  1. N RXIEN,DRGIEN,VAPRDIEN,PRTSVURL,FDAMGURL,FDAMGFN,PRINTER,STATUS
  1. ;
  1. S RXIEN=$P(PSOLST(ORN),"^",2)
  1. S DRGIEN=+$P($G(RX0),"^",6)
  1. I '$D(^PSDRUG(DRGIEN,0)) W $C(7),!!,"Invalid Drug" D WAIT^VALM1 Q
  1. S VAPRDIEN=+$P($G(^PSDRUG(DRGIEN,"ND")),"^",3)
  1. I 'VAPRDIEN W $C(7),!!,$$GET1^DIQ(50,DRGIEN,.01)_" not matched to the National Drug File (NDF)" D WAIT^VALM1 Q
  1. I '$$MGONFILE^PSOFDAUT(RXIEN) W $C(7),!!,"No FDA Medication Guide on file for this Rx." D WAIT^VALM1 Q
  1. I $$GET1^DIQ(59,PSOSITE,134)="" W $C(7),!!,"FDA Med Guide automatic printing functionality is turned OFF for this site." D WAIT^VALM1 Q
  1. ;
  1. D FULL^VALM1
  1. ;
  1. ; Printer Selection
  1. F D Q:$P(PRINTER,"^",2)'=""!(PRINTER="^")
  1. . S PRINTER=$$SELPRT^PSOFDAUT($P($G(PSOFDAPT),"^")) Q:PRINTER="^"
  1. . I $P(PRINTER,"^",2)="" W $C(7),!,"You must select a valid FDA Medication Guide printer."
  1. I PRINTER="^" D WAIT^VALM1 Q
  1. ;
  1. S PSOFDAPT=PRINTER
  1. ;
  1. W !,"Select FDA Medication Guide to reprint:",!
  1. S FDAMGFN=$$FDAMGDOC^PSOFDAUT(RXIEN) I FDAMGFN="^" D WAIT^VALM1 Q
  1. ;
  1. ; Concatenating/Encoding the Web Server URL to the FDA Med Guide file name
  1. S RXNUM=$$GET1^DIQ(52,RXIEN,.01)
  1. S PATNAM=$$GET1^DIQ(52,RXIEN,2)
  1. S FDAMGURL=$$ENCODE^XTHCURL($$GET1^DIQ(59.7,1,100)_FDAMGFN_"^"_RXNUM_"^"_PATNAM_"^"_$P(PSOFDAPT,"^",2)_"^")
  1. ;
  1. S PRTSVURL=$$GET1^DIQ(59,+$G(PSOSITE),134)_"Eep9qUmT="
  1. ;
  1. ;Invoking Kernel HTTP Toolkit //Zaleplon_(Sonata)_(2007).pdf
  1. S STATUS=$$GETURL^XTHC10(PRTSVURL_FDAMGURL,30)
  1. I (+STATUS=200) D
  1. . W !!,"FDA Medication Guide sent to printer."
  1. I (+STATUS=-1) W !!,"Unable to reprint FDA Medication Guide (",$P(STATUS,"^",2),")."
  1. N DIR W ! D WAIT^VALM1
  1. Q