source: FOIAVistA/tag/r/DENTAL-DEN/DENTPKG.m@ 1672

Last change on this file since 1672 was 628, checked in by George Lilly, 15 years ago

initial load of FOIAVistA 6/30/08 version

File size: 3.6 KB
Line 
1DENTPKG ;ISC2/SAW-INITIALIZE DENTAL PACKAGE ; 11/2/88 5:18 PM ;
2 ;VERSION 1.2
3 S:'$D(^DENT("VERSION")) ^("VERSION")=0
4 I ^DENT("VERSION")[1.2 W *7,!!,"You have already initialized version 1.2. You cannot initialize it twice." W:^DENT("VERSION")="I1.2" *7,!!,"Your initialization was never completed. Contact your local ISC for help." Q
5 W !,"This routine will perform the following functions:",!!,?4,"1. Initialize the new file structures for the Dental Package.",!,?4,"2. Purge (delete) all old data prior to October 1985."
6 W !,?4,"3. Ensure that all data prior to October 1988 is marked as released.",!,?4,"4. Convert the data in the Treatment Data and Non Clinical Time files to",!,?8,"appear in reverse date/time order whenever it is displayed."
7ASK S U="^" W !!,"Are you sure you want to initialize the Dental Package" S %=2 D YN^DICN Q:%=2!(%<0) I %=0 W !,"Answer 'YES' if you want to proceed with this initialization/conversion." G ASK
8 ;INITIALIZE DENTAL PACKAGE FILES
9 K ^DIC(220.2),^DIC(220.3) W !!,"First let me initialize the files used in the Dental Package",!! D ^DENTINIT
10 S ^DENT("VERSION")="I1.2" W !!,"Next I need to run a database conversion." S X=$P(^DENT(221,0),"^",4),X=X+$P(^DENT(226,0),"^",4)
11 W !,"This conversion takes approximately 1 minute per 366 entries to be converted.",!,"You have ",X," entries in files 221 and 226 that need to be converted, so"
12 W !,"your conversion should take approximately ",$J(X/366,0,1)," minutes.",!!,"Begin file 221 conversion."
13 D NOW^%DTC S DATE=X K %,%H,%I F I=222,223,224 S DA=0,DIK="^DENT("_I_"," F J=1:1 S DA=$O(^DENT(I,DA)) Q:DA'>0 D CHK
14 K ^DENT(221,"A"),^DENT(221,"A1"),^DENT(221,"AC"),^DENT(221,"AC1"),^DENT(221,"B"),^DENT(221,"B1"),^DENT(221,"C"),^DENT(221,"D"),^DENT(221,"E"),^DENT(221,"AG")
15 W ! S DA=0,DIK="^DENT(221," F I=0:1 S DA=$O(^DENT(221,DA)) Q:DA>1000000!(DA'>0) S X=^(DA,0) D 221 W:I#100=0 "." W:I#1000=0 " "_I_" entries converted in file 221.",!
16 W !,"File 221 conversion finished. "_I_" entries converted.",!!,"Begin file 226 conversion.",!
17 I I S $P(^DENT(221,0),"^",3)=IEN
18 K ^DENT(226,"A"),^DENT(226,"A1"),^DENT(226,"AC"),^DENT(226,"B"),^DENT(226,"B1"),^DENT(226,"C")
19 W ! S DA=0,DIK="^DENT(226," F I=0:1 S DA=$O(^DENT(226,DA)) Q:DA>1000000!(DA'>0) S X=^(DA,0) D 226^DENTPKG2 W:I#100=0 "." W:I#1000=0 " "_I_" entries converted in file 226.",!
20 W !,"File 226 conversion finished. "_I_" entries converted.",!
21 I I S $P(^DENT(226,0),"^",3)=IEN
22 S ^DENT("VERSION")=1.2 W *7,!!,"Initialization of the Dental Package is complete." K %,DA,DATE,DIK,F,I,IEN,J,N,X,X0,X1,X2,X3,X4,Y,Z,Z1 Q
23CHK S X=$P(^DENT(I,DA,0),"^") I X<2851001 D ^DIK Q
24 G CHK1:X'<2871001 I '$D(^DENT(I,DA,.1)) S ^(.1)=".5^2000101" Q
25 I $P(^DENT(I,DA,.1),"^")="" S ^(.1)=".5^2000101" Q
26CHK1 I X>DATE S Y=X X ^DD("DD") S F=I D N
27 Q
28221 I $P(X,"^")<2851001 D ^DIK Q
29 S Z=$P(X,"^"),Z1=$P(Z,"."),X0=$S('$D(^DENT(221,DA,.1)):"",$P(^(.1),"^")="":"",1:^(.1))
30 I Z<2871001,X0="" S X0=".5^2000101"
31 S IEN=9999999-(Z1_"."_(9999-$E($P(Z,".",2)_"000",1,4))) K ^DENT(221,DA,0),^(.1)
32 S ^DENT(221,IEN,0)=X S:X0'="" ^(.1)=X0 S ^DENT(221,"B",Z1,IEN)="",^DENT(221,"B1",Z,IEN)=""
33 S X1=$P(X,"^",40),X2=$P(X,"^",10) S:X2'="" ^DENT(221,"C",X2,IEN)="" I X1 S ^DENT(221,"A1",X1,Z1,IEN)="" I X2'="" S ^DENT(221,"AC1",X1,Z1,X2,IEN)=""
34 I X1,X0="" S ^DENT(221,"A",X1,Z1,IEN)="" I X2'="" S ^DENT(221,"AC",X1,Z1,X2,IEN)=""
35 I $P(X,"^",2)'="" S ^DENT(221,"D",$P(X,"^",2),IEN)=""
36 I $P(X,"^",4) S ^DENT(221,"E",$P(X,"^",4),IEN)=""
37 I $P(X0,"^",2),X1 S ^DENT(221,"AG",X1,$P(X0,"^",2),IEN)=""
38 I Z>DATE S Y=X X ^DD("DD") S F=221 D N
39 Q
40N W !,"NOTE: You have an erroneous entry dated "_Y_" in file "_F_".",!,"Please correct it after the initialization is complete.",! Q
Note: See TracBrowser for help on using the repository browser.