PRSPEM ;WOIFO/MGD - PTP ENTER MEMORANDUM ;06/01/05 ;;4.0;PAID;**93**;Sep 21, 1995;Build 7 ;;Per VHA Directive 2004-038, this routine should not be modified. ; ;The following routine will allow HR to enter a Part Time Physician's ;Memorandum of Service Level Expectations. Memorandums will cover 364 ;days (26 full Pay Periods) and the Agreed Hours must be equally ;divisible by 26. ; Q MAIN ; Main Driver N DFN,STDAT,ENDAT,AHRS,ICOM,ESOK ; Prompt for Part Time Physician D PTP I PRSIEN'>0 D KILL Q ; Display Header info to validate the correct employee was chosen D HDR ; Prompt and validate Start Date. Calculate and display End Date S QUIT=0 F D Q:QUIT!('OVERLAP) . S OVERLAP=0 . D START . Q:QUIT . D END I QUIT D KILL Q ; ; Prompt and validate Agreed Hours D AHRS I Y'>0 D KILL Q ; Prompt for Initial Comments D ICOM I Y="^" D KILL Q ; Prompt for E-Sig and save if confirmed D ESIG Q ; PTP ; Prompt for Part Time Physician N SSN W ! S DIC="^PRSPC(",DIC(0)="AEMQZ",DIC("A")="Select EMPLOYEE: " D ^DIC K DIC S PRSIEN=+Y Q:PRSIEN<1 ; ; determine associated NEW PERSON entry S SSN=$$GET1^DIQ(450,PRSIEN_",",8,"I") S IEN200=$S(SSN="":"",1:$O(^VA(200,"SSN",SSN,0))) I 'IEN200 D . W $C(7),!!,"Can't find an entry in the NEW PERSON file for this employee." . W !,"They must be added as a user before the memorandum is created." . S PRSIEN=-1 Q ; HDR ; Display PTP info S SCRTTL="Enter PT Physician Memoranda" D HDR^PRSPUT1(PRSIEN,SCRTTL) W ! Q ; START ; Prompt for Start Date ; This subroutine prompts for the date then goes through several ; checks if any check fails we give an explanation message and ; reprompt for the date. If no checks fail we set valid to ; quit. The user must ^ or timeout to quit. ; N VALID S VALID=0 F D Q:QUIT!(VALID) . N Y,DIR,DIRUT S DIR(0)="458.7,1A0",DIR("A")="Start Date: " D ^DIR .; Validate that the Start Date is the first day of a Pay Period. . I $D(DIRUT) S QUIT=1 Q . S D1=+Y . D PP^PRSAPPU . I DAY'=1 D Q . . D SILMO^PRSLIB01(D1) . . W !,"You entered ",$$EXTERNAL^DILFD(458.7,1,,D1) . . W !!,"The Start Date must be the first day of a Pay Period." . . W !,"Please re-enter.",! . S STDAT=D1 .; Check to see if this employee's timecard for this PP is .; in a status other than Timekeeper . S PPI=$P($G(^PRST(458,"AD",D1)),U) . I (D10) D Q . . W !!,?3,"There is no pay period on file for that past date." .; .; for all past dates the employee must have a timecard in a .; a status of 'T" .; . I (D10),$D(^PRST(458,PPI,"E",PRSIEN,0)),($P($G(^PRST(458,PPI,"E",PRSIEN,0)),U,2)'="T") D Q . . W !!,?3,"This employee's timecard has a status other than " . . W !,?3,"Timekeeper. It will have to be returned to the Timekeeper " . . W !,?3,"before a memo covering this pay period can be entered." .; .; If we make it through all the checks set valid and QUIT only gets .; set when we abort or timeout . S VALID=1 Q ; END ; Calculate and display End Date N X1,X2,X,Y S X1=D1,X2=363 D C^%DTC S ENDDAT=X,Y=X D DD^%DT W !," End Date: ",Y K D1 ; Verify that there are no other Memorandums covering this same time S IEN="" F S IEN=$O(^PRST(458.7,"B",PRSIEN,IEN)) Q:IEN="" D Q:QUIT . S DATA=$G(^PRST(458.7,IEN,0)) . Q:DATA="" . S START=$P(DATA,U,2),END=$P(DATA,U,3),STATUS=$P(DATA,U,6) . S TDAT=$P($G(^PRST(458.7,IEN,4)),U,1) ; Termination Date . S END=$S(TDAT:TDAT,1:END) . I STDAT'>START,ENDDAT'END,ENDDAT'