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

PSSMEDCH.m

Go to the documentation of this file.
  1. PSSMEDCH ;BIR/RTR-Med Route Mapping Change Report ;07/03/07
  1. ;;1.0;PHARMACY DATA MANAGEMENT;**129**;9/30/07;Build 67
  1. ;
  1. DRIVER ;
  1. ;Med Route Mapping History Report
  1. W !!!,"This report displays changes made to the mapping of Medication Routes in the"
  1. W !,"MEDICATION ROUTES (#51.2) File to Medication Routes in the STANDARD"
  1. W !,"MEDICATION ROUTES (#51.23) File.",!
  1. N DIR,PSSHTYPE,PSSMDONE,DIC,Y,PSSMHRSI,PSSMHRSE,PSSMHREI,PSSMHREE,PSSMHRXX,X,X1,X2,DUOUT,DTOUT,DIRUT,DIROUT,%H,IOP,%ZIS,POP,ZTRTN,ZTSAVE,ZTDESC,ZTSK
  1. K DIR S DIR(0)="SO^S:Single Med Route;A:All Med Routes",DIR("A")="Print report for a Single Med Route, or All Med Routes",DIR("B")="S"
  1. S DIR("?")=" ",DIR("?",1)="Enter 'S' to see a Standard Medication Route mapping history",DIR("?",2)="of one local Medication Route, enter 'A' to see a Standard Medication"
  1. S DIR("?",3)="Route mapping history of all the local Medication Routes."
  1. D ^DIR K DIR I $D(DUOUT)!($D(DTOUT)) D MESS Q
  1. I Y'="S",Y'="A" D MESS Q
  1. S PSSHTYPE=Y
  1. I PSSHTYPE="A" G DATE
  1. K DIC W ! S DIC="^PS(51.2,",DIC(0)="QEAM",DIC("A")="Select Med Route: " D ^DIC K DIC I Y<1!($D(DUOUT))!($D(DTOUT)) D MESS Q
  1. S PSSMDONE=+Y
  1. DATE ;
  1. W !
  1. K DIR W ! S DIR(0)="DAO^:DT:APEX",DIR("A")="Beginning Date: ",DIR("?")=" ",DIR("?",1)="Enter the date to begin searching for Medication Route mapping changes.",DIR("?",2)="A future date cannot be entered." D ^DIR K DIR
  1. I 'Y!($D(DTOUT))!($D(DUOUT)) D MESS Q
  1. S (PSSMHRSI,PSSMHRXX)=Y D DD^%DT S PSSMHRSE=Y
  1. K X S X1=PSSMHRSI,X2=-1 D C^%DTC S PSSMHRSI=X_".9999"
  1. W ! K DIR S DIR(0)="DAO^"_PSSMHRXX_"::APEX",DIR("A")="Ending Date: ",DIR("?")=" ",DIR("?",1)="Enter the ending date of the search for Medication Route mapping changes.",DIR("?",2)="This date cannot be before the beginning date." D ^DIR K DIR
  1. I 'Y!($D(DTOUT))!($D(DUOUT)) D MESS Q
  1. S PSSMHREI=Y D DD^%DT S PSSMHREE=Y
  1. K X S X1=PSSMHREI,X2=+1 D C^%DTC S PSSMHREI=X
  1. W ! K IOP,%ZIS,POP S %ZIS="QM" D ^%ZIS I $G(POP) D MESS Q
  1. I $D(IO("Q")) D K IOP,%ZIS,POP,DIR S DIR(0)="E",DIR("A")="Press Return to continue" D ^DIR K DIR Q
  1. .S ZTRTN="START^PSSMEDCH",ZTDESC="Medication Route Mapping History report",ZTSAVE("PSSHTYPE")="",ZTSAVE("PSSMDONE")="",ZTSAVE("PSSMHRSI")="",ZTSAVE("PSSMHRSE")="",ZTSAVE("PSSMHREI")="",ZTSAVE("PSSMHREE")="" D ^%ZTLOAD D
  1. .W !!,"Report queued to print.",!
  1. START ;
  1. U IO
  1. N PSSMHRLN,PSSMHOUT,PSSMHDEV,PSSMHCT,PSSMHLEN,PSSMHNAM
  1. N PSSMHRG1,PSSMHRG2,PSSMHRG3,PSSMHRG4,PSSMHRG5,PSSMHRG7,PSSMHRG9
  1. S PSSMHRG9=0
  1. I PSSHTYPE="S" S PSSMHNAM=$P($G(^PS(51.2,+PSSMDONE,0)),"^"),PSSMHLEN=$L(PSSMHNAM)
  1. S PSSMHOUT=0,PSSMHDEV=$S($E(IOST,1,2)'="C-":"P",1:"C"),PSSMHCT=1
  1. K PSSMHRLN S $P(PSSMHRLN,"-",79)=""
  1. D HD
  1. I PSSHTYPE="S" D G END
  1. .F PSSMHRG1=PSSMHRSI:0 S PSSMHRG1=$O(^PS(51.2,PSSMDONE,2,"B",PSSMHRG1)) Q:'PSSMHRG1!(PSSMHRG1'<PSSMHREI)!(PSSMHOUT) D
  1. ..F PSSMHRG2=0:0 S PSSMHRG2=$O(^PS(51.2,PSSMDONE,2,"B",PSSMHRG1,PSSMHRG2)) Q:'PSSMHRG2!(PSSMHOUT) D
  1. ...S PSSMHRG7=$G(^PS(51.2,PSSMDONE,2,PSSMHRG2,0)) Q:PSSMHRG7=""
  1. ...S PSSMHRG4=PSSMHRG2_","_PSSMDONE_","
  1. ...D PRINT
  1. F PSSMHRG1=PSSMHRSI:0 S PSSMHRG1=$O(^PS(51.2,"D",PSSMHRG1)) Q:'PSSMHRG1!(PSSMHRG1'<PSSMHREI)!(PSSMHOUT) D
  1. .F PSSMHRG2=0:0 S PSSMHRG2=$O(^PS(51.2,"D",PSSMHRG1,PSSMHRG2)) Q:'PSSMHRG2!(PSSMHOUT) D
  1. ..F PSSMHRG3=0:0 S PSSMHRG3=$O(^PS(51.2,"D",PSSMHRG1,PSSMHRG2,PSSMHRG3)) Q:'PSSMHRG3!(PSSMHOUT) D
  1. ...S PSSMHRG7=$G(^PS(51.2,PSSMHRG2,2,PSSMHRG3,0)) Q:PSSMHRG7=""
  1. ...S PSSMHRG4=PSSMHRG3_","_PSSMHRG2_","
  1. ...S PSSMHNAM=$P($G(^PS(51.2,PSSMHRG2,0)),"^")
  1. ...D PRINT
  1. END ;
  1. I '$G(PSSMHOUT),'$G(PSSMHRG9) W !!,?2,"No mapping changes to report.",!
  1. I $G(PSSMHDEV)="P" W !!,"End of Report.",!
  1. I '$G(PSSMHOUT),$G(PSSMHDEV)="C" W !!,"End of Report.",! K DIR S DIR(0)="E",DIR("A")="Press Return to continue" D ^DIR K DIR
  1. I $G(PSSMHDEV)="C" W !
  1. E W @IOF
  1. K PSSHTYPE,PSSMDONE,PSSMHRSI,PSSMHRSE,PSSMHREI,PSSMHREE D ^%ZISC S:$D(ZTQUEUED) ZTREQ="@"
  1. Q
  1. ;
  1. PRINT ;
  1. S PSSMHRG9=1
  1. K PSSMHRG5 D GETS^DIQ(51.27,PSSMHRG4,".01;1;2;3","E","PSSMHRG5")
  1. W !!,?2,"Medication Route: "_$G(PSSMHNAM)
  1. W !?9,"Date/Time: "_$G(PSSMHRG5(51.27,PSSMHRG4,.01,"E"))
  1. I ($Y+5)>IOSL D HD Q:PSSMHOUT
  1. W !?9,"Edited By: "_$S($G(PSSMHRG5(51.27,PSSMHRG4,1,"E"))'="":$G(PSSMHRG5(51.27,PSSMHRG4,1,"E")),1:"AUTOMAPPED")
  1. I ($Y+5)>IOSL D HD Q:PSSMHOUT
  1. W !?9,"Old Value: "_$S($G(PSSMHRG5(51.27,PSSMHRG4,2,"E"))'="":$G(PSSMHRG5(51.27,PSSMHRG4,2,"E")),1:"<no previous value>")
  1. I ($Y+5)>IOSL D HD Q:PSSMHOUT
  1. W !?9,"New Value: "_$S($G(PSSMHRG5(51.27,PSSMHRG4,3,"E"))'="":$G(PSSMHRG5(51.27,PSSMHRG4,3,"E")),1:"<no new value>")
  1. I ($Y+5)>IOSL D HD Q:PSSMHOUT
  1. Q
  1. ;
  1. HD ;
  1. I $G(PSSMHDEV)="C",$G(PSSMHCT)'=1 W ! K DIR S DIR(0)="E",DIR("A")="Press Return to continue, '^' to exit" D ^DIR K DIR I 'Y S PSSMHOUT=1 Q
  1. W @IOF
  1. I PSSHTYPE="A" W !,"Medication Route mapping changes for ALL Medication Routes"
  1. I PSSHTYPE="S" W !,"Medication Route mapping changes for " D
  1. .I +PSSMHLEN<43 W PSSMHNAM Q
  1. .W !,?34,PSSMHNAM
  1. W !,"made between "_PSSMHRSE_" and "_PSSMHREE,?68,"PAGE: "_PSSMHCT,!,PSSMHRLN,! S PSSMHCT=PSSMHCT+1
  1. Q
  1. MESS ;
  1. W !!,"Nothing queued to print.",!
  1. K DIR W ! S DIR(0)="E",DIR("A")="Press Return to continue" D ^DIR K DIR
  1. Q