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

PSXVPN.m

Go to the documentation of this file.
PSXVPN ;BIR/WRT-Report of Local drugs with the same VA Print Name ;[ 10/19/98  8:55 AM ]
 ;;2.0;CMOP;**18,19,23**;11 Apr 97
 ;Reference to ^PSDRUG( supported by DBIA #1983
TEXT W !!,"This option will produce a report to help you review your NDF matches.",!
 W "The report will group drugs together that are matched to the same VA Print",!,"Name along with the VA Dispense Unit. These will be used for CMOP purposes.",!,"You may queue the report to print, if you wish.",!!
DVC K IO("Q"),%ZIS,POP,IOP S %ZIS="QM",%ZIS("B")="",%ZIS("A")="DEVICE: " D ^%ZIS G:POP DONE W:$E(IOST)'="P" !!,"This report must be run on a printer.",!! G:$E(IOST)'="P" DVC I POP K IOP,POP,IO("Q") Q
QUEUE I $D(IO("Q")) K IO("Q") S ZTRTN="ENQ^PSXVPN" K ZTSAVE,ZTDTH,ZTSK S PSXDEV=ION_";"_IOST_";"_IOM_";"_IOSL,ZTSAVE("PSXDEV")="",ZTSAVE("PSXANS")="",ZTDESC="CMOP Local Drugs with same VA Print Name Report",ZTIO=""
 I  D ^%ZTLOAD K MJT,%ZIS,POP,IOP,ZTSK D ^%ZISC Q
ENQ ;Called by Taskman to run report of Local drugs with same name report
 D LOOP
 I $D(ZTQUEUED) D QUEUE1
 U IO
ENQ1 S PSXPGCT=0,PSXPGLNG=IOSL-6
 D TITLE,LOOP1 W @IOF G DONE
TITLE I $D(IOF),IOF]"" W @IOF S PSXPGCT=PSXPGCT+1
 W !,?10,"LOCAL DRUGS MATCHED TO THE SAME VA PRINT NAME",!
 S X="T" D ^%DT X ^DD("DD") W ?55,"Date printed: ",Y,!?55,"Page: ",PSXPGCT,!
 W !,"VA PRINT NAME",?55,"VA DISPENSE UNIT",!,?5,"Local GENERIC NAME",?60,"Local DISPENSE UNIT",!
 F MJT=1:1:80 W "-"
 Q
DONE S:$D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