| 1 | PRSALVX ;HISC/REL - Cancel Leave Request ;12/15/04 | 
|---|
| 2 | ;;4.0;PAID;**61,93,114**;Sep 21, 1995;Build 6 | 
|---|
| 3 | ;;Per VHA Directive 2004-038, this routine should not be modified. | 
|---|
| 4 | N SKIP,ZOLD | 
|---|
| 5 | S DFN="",SSN=$P($G(^VA(200,DUZ,1)),"^",9) I SSN'="" S DFN=$O(^PRSPC("SSN",SSN,0)) | 
|---|
| 6 | I 'DFN W !!,*7,"Your SSN was not found in both the New Person & Employee File!" G EX | 
|---|
| 7 | S TLE=$P($G(^PRSPC(DFN,0)),"^",8) S:TLE="" TLE="   " S TLI=+$O(^PRST(455.5,"B",TLE,0)) | 
|---|
| 8 | W:$E(IOST,1,2)="C-" @IOF W !?26,"VA TIME & ATTENDANCE SYSTEM",!?29,"CANCEL LEAVE REQUESTS" | 
|---|
| 9 | S X=$G(^PRSPC(DFN,0)) W !!,$P(X,"^",1) S X=$P(X,"^",9) I X W ?50,"XXX-XX-",$E(X,6,9) | 
|---|
| 10 | K %DT S %DT="AEFX",%DT("A")="Begin with Date: ",%DT("B")="T" W ! D ^%DT K %DT S:$D(DTOUT) Y=0 G:Y<1 EX S EDT=9999999-Y | 
|---|
| 11 | W ! S NUM=1 D DISP^PRSALVS | 
|---|
| 12 | G:'CNT EX | 
|---|
| 13 | X1 R !!,"Cancel Which Request #? ",X:DTIME G:'$T!("^"[X) EX I X'?1N.N!(X<1)!(X>CNT) W *7," Enter # of Request to Cancel" G X1 | 
|---|
| 14 | S X=+X,DA=R(X) | 
|---|
| 15 | ; | 
|---|
| 16 | ; if request is approved and employee has any part-time physician memos | 
|---|
| 17 | ; then lock appropriate pay periods | 
|---|
| 18 | K PPLCK,PPLCKE | 
|---|
| 19 | S SKIP=0 | 
|---|
| 20 | S ZOLD=$G(^PRST(458.1,DA,0)) | 
|---|
| 21 | I $P(ZOLD,U,12),$$PTP^PRSPUT3($P(ZOLD,U,2)) D | 
|---|
| 22 | . ; lock applicable time cards | 
|---|
| 23 | . D LCK^PRSPAPU($P(ZOLD,U,2),$$FMADD^XLFDT($P(ZOLD,U,3),-1),$P(ZOLD,U,5),.PPLCK,.PPLCKE) | 
|---|
| 24 | . ; if problem locking time cards | 
|---|
| 25 | . I $D(PPLCKE) D | 
|---|
| 26 | . . S SKIP=1 ; set flag to skip cancel of leave | 
|---|
| 27 | . . D TCULCK^PRSPAPU($P(ZOLD,U,2),.PPLCK) ; unlock any locked PP | 
|---|
| 28 | . . D RLCKE^PRSPAPU(.PPLCKE) ; report problems | 
|---|
| 29 | . . K PPLCK,PPLCKE | 
|---|
| 30 | Q:SKIP  ; don't proceed with cancel | 
|---|
| 31 | ; | 
|---|
| 32 | ; cancel leave request | 
|---|
| 33 | S $P(^PRST(458.1,DA,0),"^",9)="X" K ^PRST(458.1,"AR",DFN,DA) | 
|---|
| 34 | ; | 
|---|
| 35 | ; if timecards were locked (PTP), unpost the leave and remove the locks | 
|---|
| 36 | I $D(PPLCK) D | 
|---|
| 37 | . D ULR^PRSPLVA(ZOLD) | 
|---|
| 38 | . D TCULCK^PRSPAPU($P(ZOLD,U,2),.PPLCK) | 
|---|
| 39 | . K PPLCK | 
|---|
| 40 | ; | 
|---|
| 41 | ; update T&L action counts | 
|---|
| 42 | D UPD^PRSASAL W "  ... done" | 
|---|
| 43 | EX G KILL^XUSCLEAN | 
|---|