source: WorldVistAEHR/trunk/r/VOLUNTARY_TIMEKEEPING-ABSV/ABSVTC.m@ 738

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

initial load of WorldVistAEHR

File size: 4.4 KB
RevLine 
[613]1ABSVTC ;VAMC ALTOONA/CTB_CLH - ALTOONA CREATE TIME CARD ;3/8/00 4:21 PM
2V ;;4.0;VOLUNTARY TIMEKEEPING;**6,10,18**;JULY 6, 1994
3 K ^TMP("ABSV",$J),N,REC,TCREC,X
4 S ABSVXA="This program should ONLY be run during the first six (6) workdays of each month."
5 S ABSVXA(1)="ARE YOU SURE YOU WANT TO CONTINUE",%=2 D ^ABSVYN Q:%'=1
6 W !!
7 D ^ABSVSITE G OUT:'%
8 W !!
9 S %DT="AE",%DT("A")="Select Processing Month: " D ^%DT G OUT:Y<0
10 S DATE=$E(Y,1,5)_"00" I $D(^ABS(503331,"AF",DATE))<9 W !,"No daily records have been entered for this month.",*7 Q
11 I $D(^ABS(503335,"AK",DATE)) D I %'=1 S X="< No Action Taken>*" D MSG^ABSVQ G OUT
12 . S N=0,COUNT=0 F I=1:1 S N=$O(^ABS(503335,"AK",DATE,N)) Q:'N I $D(^ABS(503335,N,0)),$P(^(0),"^",12)=ABSV("SITE") S COUNT=COUNT+1
13 . I 'COUNT S %=1 Q
14 . S ABSVXA=COUNT_" Time Card"_$S((I-1)>0:"s",1:"")_" already exist"_$S((I-1)>0:"",1:"s")_" for station "_ABSV("SITE")_" for "_$$FULLDAT^ABSVU2(DATE)_"."
15 . S ABSVXA(1)="Continuing will DELETE all these cards from the system.",ABSVXA(1.5)=" "
16 . S ABSVXA(2)="ARE YOU SURE YOU WANT TO CONTINUE",ABSVXB="",%=2 D ^ABSVYN
17 . QUIT:%'=1
18 . S ABSVXA="ARE YOU ABSOLUTELY POSITIVE",ABSVXB="",%=2 W !,*7 D ^ABSVYN
19 . I %=1 W !!,"OK, Here we go.",!,*7
20 . QUIT
21 S ZTDESC="Roll up Voluntary time card data",ZTRTN="QUE^ABSVTC",ZTSAVE("DATE")="",ZTSAVE("ABSV*")="" D ^ABSVQ
22OUT K %,%DT,ABSVXW,ABSVXX,ABSVX1,ABSVXY1,COMB,COUNT,DATE,DAY,DCC,DIJ,DIOP,DIPT,DLAYGO,F,FLDS,HRS,I,L,N,NAME,O,ORG,R1,REC,W,X,Y,VOLDA,Z,ZX
23 Q
24QUE ;
25 ;THE FOLLOWING LINE DELETES ALL TIME CARDS FOR THE MONTH
26 I $D(^ABS(503335,"AK",DATE)) D
27 . I '$D(ZTQUEUED)&(IO=IO(0)) S X="**while I clean up the time card file" D WAIT^ABSVYN
28 . S DA=0 F S DA=$O(^ABS(503335,"AK",DATE,DA)) Q:'DA I $D(^ABS(503335,DA,0)),$P(^(0),"^",12)=ABSV("SITE") S DIK="^ABS(503335," D ^DIK W "."
29 . QUIT
30 ;
31 ;THE FOLLOWING CODE ROLLS UP ALL THE TIME FOR EACH VOLUNTEER AND STORES IN IT ^TMP("ABSV",$J,VOLUNTEER DA NUMBER)
32 I '$D(ZTQUEUED)&(IO=IO(0)) S X="**while I roll up the times for each volunteer" D WAIT^ABSVYN
33 K ^TMP("ABSV",$J)
34 S N=0 F S N=$O(^ABS(503331,"AF",DATE,N)) Q:'N I $D(^ABS(503331,N,0)) S REC=^(0) I $P(REC,"^",2)=DATE,$P(REC,"^",7)=ABSV("SITE") D
35 . S NAME=$P(REC,"^"),HRS=$P(REC,"^",5),COMB=$P(REC,"^",6),DAY=+$E($P(REC,"^",3),6,7)
36 . S:'$D(^TMP("ABSV",$J,NAME,COMB)) $P(^(COMB),"^",32)="" S:'$D(^TMP("ABSV",$J,NAME,COMB,0)) ^(0)=$P(REC,"^",4)_"^"_$P(REC,"^",8)
37 . I +HRS'=0 S:HRS>9 HRS=9 S $P(^(COMB),"^",DAY)=$P(^TMP("ABSV",$J,NAME,COMB),"^",DAY)+HRS,$P(^(COMB),"^",32)=$P(^(COMB),"^",32)+HRS
38 . QUIT
39 ;
40 S VOLDA=0 F S VOLDA=$O(^TMP("ABSV",$J,VOLDA)) Q:'VOLDA W "." D
41 . S COMB=0 F S COMB=$O(^TMP("ABSV",$J,VOLDA,COMB)) Q:COMB="" W "." D
42 . . Q:'$D(^ABS(503330,+$G(VOLDA),0))
43 . . S X=VOLDA,DLAYGO=503335,DIC="^ABS(503335,",DIC(0)="LMNZ"
44 . . K DO D FILE^DICN K DIC,DLAYGO
45 . . I +Y<0 W "*Problem with "_$P(^ABS(503330,VOLDA,0),"^")_", Combination "_COMB_". Time Card was not created. *" QUIT
46 . . S DA=+Y,ORG=$G(^TMP("ABSV",$J,VOLDA,COMB,0)),DR="1////"_COMB_";2////0;4////"_DATE_";1.9////1;1.1////"_$P(ORG,"^")_";1.2////"_$P(ORG,"^",2)_";3////"_ABSV("SITE")_";4.5////1"
47 . . S DIE="^ABS(503335," D ^DIE
48 . . S ^ABS(503335,DA,1)=^TMP("ABSV",$J,VOLDA,COMB)
49 . . QUIT
50 . QUIT
51 ;;PRINT TIME CARD
52 S IOP=ABIOP
53X S DIC="^ABS(503335,",L=0,(TO,FR)=DATE,DIS(0)="I $P($G(^ABS(503335,D0,0)),U,12)=ABSV(""SITE"")",BY="[ABSV TC SORT]",FLDS="[ABSV TC PRINT]" D EN1^DIP
54 S IOP=ABIOP
55 S DIC="^ABS(503335,",L=0,(TO,FR)=DATE,DIS(0)="I $P($G(^ABS(503335,D0,0)),U,12)=ABSV(""SITE""),$$COUNT^ABSVTC($G(^ABS(503335,D0,1)))>26",BY="[ABSV TC SORT]",FLDS="[ABSV TC PRINT]",DHD="TIMECARDS HAVING MORE THAN 26 ENTRIES" D EN1^DIP
56 S IOP=ABIOP
57 S DIC="^ABS(503335,",L=0,(TO,FR)=DATE,DIS(0)="I $P($G(^ABS(503335,D0,0)),U,12)=ABSV(""SITE""),'$$COMB^ABSVTC(D0)",BY="[ABSV TC SORT]",FLDS="[ABSV ERROR LIST]",DHD="TIMECARDS WITH COMBINATIONS NOT FOUND IN MASTER FILE" D EN1^DIP
58 K ^TMP("ABSV",$J),%W,%X,B,DP,DR
59 QUIT
60COUNT(X) ;DOES RECORD HAVE MORE THAN 26 ENTRIES
61 N COUNT,I
62 S COUNT=0
63 F I=1:1:31 I $P(X,"^",I)>0 S COUNT=COUNT+1
64 Q COUNT
65COMB(D0) ;DETERMINES IF COMBINATION STILL EXISTS IN MASTER FILE
66 ;VERIFIES THAT 135AQ is not used in combination
67 N N,DA,OK,X,XCOMB,XSITE,SITE,COMB
68 S OK=0,X=$G(^ABS(503335,D0,0)),DA=+X,COMB=$P(X,"^",2),SITE=$P(X,"^",12)
69 S N=0 F S N=$O(^ABS(503330,DA,1,N)) Q:'N S X=$G(^ABS(503330,DA,1,N,0)) Q:X="" D Q:OK
70 . S XCOMB=$P(X,"^",5),XSITE=$P(X,"-")
71 . I (XCOMB=COMB),XSITE=SITE S OK=1
72 . QUIT
73 Q OK
74VISIT(D0) ;
75 N Z,I,X S Z=$G(^ABS(503335,D0,1)) S X=0 F I=1:1:31 I $P(Z,"^",I)]"" S X=X+1
76 Q X
Note: See TracBrowser for help on using the repository browser.