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

APSPERRY.m

Go to the documentation of this file.
  1. APSPERRY ;IHS/DSD/PR - Copy drug file for each selected division; [ 09/09/97 8:45 AM ]
  1. ;;6.0;IHS PHARMACY MODIFICATIONS;;09/03/97
  1. ;
  1. EN(PSOMAKE) ;EP
  1. ;D EN^PSOPERRY(SITE) ;user will NOT be asked site.
  1. ; (.SITE) ;User will NOT be asked site.
  1. ; () ;user will be asked site.
  1. ;
  1. I $D(PSOMAKE) D Q
  1. .I '$O(PSOMAKE(0)) S PSOMAKE(PSOMAKE)=""
  1. .D Q
  1. ;
  1. ;
  1. K PSOMAKE,PSOQUIT
  1. F S DIC=59,DIC(0)="AEQM",DIC("A")="Select Division(s): " D ^DIC S:Y>0 PSOMAKE(+Y)="" I Y'>0 Q
  1. I '$O(PSOMAKE(0)) S PSOQUIT=1
  1. I $D(PSOQUIT) D K Q
  1. ;
  1. W !!!,"OK, I will Copy the existing drug file for divisions: " F PSODA=0:0 S PSODA=$O(PSOMAKE(PSODA)) Q:'PSODA W !,$P(^PS(59,PSODA,0),U)
  1. ;
  1. ;Verify user wants to continue
  1. F W !!,"OK to continue" S %=2 D YN^DICN W:%=0 " Answer Yes or No" G:%'=1&(%'=0) K Q:%=1
  1. ;
  1. ;
  1. Q ;EP
  1. K IO("Q"),%ZIS,IOP,ZTDTH,ZTSAVE,ZTSK,ZTQUEUED
  1. S %ZIS="QM" D ^%ZIS I POP D K Q
  1. I $D(IO("Q")) S ZTIO=ION,ZTSAVE("PSO*")="",ZTSAVE("DUZ(")="",ZTRTN="EN2^PSOPERRY",ZTDTH=$H D ^%ZTLOAD W !,"JOB QUEUED." D ^%ZISC D K Q
  1. ;
  1. EN2 ;EP Tman entry
  1. ;Create new duplicate drug entry here.
  1. ;Stuff 'PSOSITE' (internal DA to 59) into the new division field.
  1. ;
  1. U IO W @IOF,"Drug file copy in progress."
  1. F PSOSITE=0:0 S PSOSITE=$O(PSOMAKE(PSOSITE)) Q:'PSOSITE I $D(^PS(59,PSOSITE,0)) W !!!!,"Copying new drug file for site: ",$P(^(0),U) D AUTO
  1. I IO'=IO(0) W !!,"FINISHED." W @IOF D ^%ZISC
  1. D K Q
  1. ;
  1. ;
  1. AUTO ;Auto duplicate drug data with new division.
  1. ;
  1. ;Check that first site in site file has been established
  1. S PSOBASE=$O(^PS(59,0)) I '$D(^PSDRUG("ZDIV",PSOBASE)) W !,"Unable to continue, no base to operate from." Q
  1. ;
  1. ;Check division and be sure it has not already been set up with
  1. ;the drug file.
  1. I $D(^PSDRUG("ZDIV",PSOSITE)) W !,"Site ",$P(^PS(59,PSOSITE,0),U)," has already been assigned the drug file. " Q
  1. ;
  1. ;Get the entry from the drug file to duplicate
  1. F PSODA=0:0 S PSODA=$O(^PSDRUG("ZDIV",PSOBASE,PSODA)) Q:'PSODA I $D(^PSDRUG(PSODA,0)) D
  1. .S X=$P(^PSDRUG(PSODA,0),U)
  1. .S DIC="^PSDRUG("
  1. .S DIC(0)="L"
  1. .D FILE^DICN S PSONEW=+Y
  1. .S %X="^PSDRUG("_PSODA_","
  1. .S %Y="^PSDRUG("_PSONEW_","
  1. .D %XY^%RCR
  1. .S DIE="^PSDRUG(",DA=PSONEW,DR="9999999.03////^S X=PSOSITE" D ^DIE
  1. .S DIK="^PSDRUG(",DA=PSONEW D IX1^DIK
  1. .W "."
  1. K ;