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

DGBTDIST.m

Go to the documentation of this file.
  1. DGBTDIST ;ALB/SCK-BENEFICIARY TRAVEL DEPARTURE CITY DISTANCE ENTER/EDIT;1/21/93 2/1/93 4/26/93
  1. ;;5.3;Registration;**1015**;Aug 13, 1993;Build 21
  1. Q
  1. START ;
  1. N DGBTMDIV,DGBTDIV,XX,DA,DO,X,NEWDIV,CITY
  1. D HOME^%ZIS W @IOF
  1. D WAIT^DICD,STCHK^DGBTSRCH
  1. I '$$CHECKS^DGBTDST1 W !,"No Problems were found in the Distance Data."
  1. E G:'$$FIX CLEAR
  1. CLEAR ; set division and whether multi or single instit.
  1. S DGBTMDIV=+$P($G(^DG(43,1,"GL")),U,2),NEWDIV=0,DGBTDIV=+$P($G(^DG(43,1,"GL")),U,3),ERR=0
  1. LKUP ; lookup departure city using DIR reader for input and DIC call for lookup
  1. D HEADER
  1. K DIR S DIR(0)="FO^1:30",DIR("A",1)="",DIR("A")="Enter Departure City",DIR("?",1)="Enter the name for the departure city",DIR("?")="Name must be free text, 1-30 characters in length"
  1. D ^DIR K DIR G:$D(DIRUT) EXIT S (CITY,X)=Y
  1. L +^DGBT(392.1):3 I '$T W !?5,*7,"FILE IN USE, PLEASE TRY AGAIN LATER" G EXIT
  1. S DIC="^DGBT(392.1,",DIC(0)="ELQMZ",DLAYGO="392",DIC("DR")="" D ^DIC K DIC,DLAYGO L -^DGBT(392.1) S (REC,DA)=+Y G:$D(DTOUT)!($D(DUOUT)) EXIT
  1. S:$P(Y,U,3)=1 NEWDIV=1 G:X["?"!(+Y'>0) LKUP
  1. G:$$ADDIT CLEAR
  1. DIS ; check to add additional divisions
  1. I DGBTMDIV F XX=2:1 Q:'$$NEXTDV D DIV
  1. G CLEAR
  1. EXIT ;
  1. K REC,Y,DTOUT,DUOUT,DIRUT,DR,NEWDIV,DGBTMDIV,CITY,DGBTDIV,ERR,%,DIC,DIR
  1. Q
  1. ;
  1. NEXTDV() ;
  1. N Y
  1. S DIR("A")="Enter another division for this departure city",DIR("B")="YES"
  1. S DIR(0)="YO",DIR("?")="Enter a 'Y'es to add or enter another division, or 'N'o to exit to the Departure City prompt"
  1. D ^DIR K DIR I $D(DUOUT)!($D(DTOUT)) S Y=0
  1. NEXTDIQ Q (+Y)
  1. ;
  1. ADDIT() ; enter data for new city and create 1st division
  1. N ERR
  1. S DIE="^DGBT(392.1,",DA=REC,DR=".01"_"CITY OR TOWN"_";2;4" D ^DIE I '$D(DA) S ERR=1 G ADDQ
  1. I X="",$P($G(^DGBT(392.1,DA,0)),U,2)']""&($P($G(^DGBT(392.1,DA,0)),U,4)']"") D DELETE S ERR=1 G ADDQ
  1. I $D(DTOUT)!($D(Y))!('$D(DA)) S ERR=1 G ADDQ
  1. D MILES ; print default mileage message
  1. S DR=$S(NEWDIV:"100///"_DGBTDIV,1:"100")
  1. S DR(2,392.1001)="I 'DGBTMDIV S Y=""@2"";.01;@2;2;3;4//"_"NO"_";I X=""""!(X=0) S Y=""@1"";5;@1" D ^DIE K DIE
  1. D DEFMILE L -^DGBT(392.1) ; check 1st div mile vs default miles
  1. ADDQ Q ($D(ERR))
  1. ;
  1. MILES ; print default mileage message
  1. W:DGBTMDIV&(NEWDIV) !!?10,*7,"THE MILEAGE FOR THE SELECTED DIVISION WILL BE USED AS THE",!?10,"DEFAULT MILEAGE FOR THIS DEPARTURE CITY.",!!
  1. Q
  1. DEFMILE ; compare city's default mileage vs. 1st divisions mileage, update if necessary
  1. I $P($G(^DGBT(392.1,REC,0)),U,3)'=$P($G(^DGBT(392.1,REC,1,1,0)),U,2) D
  1. . S DIE="^DGBT(392.1,",DA=REC,DR="3///^S X=+$P($G(^DGBT(392.1,DA,1,1,0)),U,2)" D ^DIE K DIE
  1. Q
  1. DIV ; add additional divisions to existing city
  1. L +^DGBT(392.1):3 I '$T W !?5,*7,"FILE IN USE, PLEASE TRY AGAIN LATER" G EXIT
  1. S DIE="^DGBT(392.1,",DA=REC,DO=XX,DR="100",DR(2,392.1001)=".01;2;3;4//"_"NO"_";I X=""""!(X=0) S Y=""@1"";5;@1" D ^DIE K DIE
  1. L -^DGBT(392.1)
  1. Q
  1. W !!,"Enter the CITY as the point of origin. The MILEAGE/ONE-WAY",!,"is the distance from the CITY to the Medical Center Division.",!
  1. Q
  1. ;
  1. DELETE ;
  1. W !!?5,*7,"INCOMPLETE INFORMATION WAS ENTERED, BOTH THE STATE AND ZIP CODE",!?5,"ARE REQUIRED, RECORD DELETED",!
  1. K DIE S DIK="^DGBT(392.1,",DA=REC D ^DIK K DIK S ERR=1
  1. Q
  1. FIX() ;
  1. W !,"You can either correct these problems, or add a new departure city."
  1. W !,"CORRECT PROBLEMS"
  1. D:$$YESNO^DGBTSRCH=1 START^DGBTSRCH
  1. Q (+%)