source: WorldVistAEHR/trunk/r/PCE_PATIENT_CARE_ENCOUNTER-AUTN-EFDP-PX-VSIT--PXRM/PXBAPI2.m@ 975

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

initial load of WorldVistAEHR

File size: 2.2 KB
RevLine 
[613]1PXBAPI2 ;ISL/DCM - API for check-out d/t ;7/10/96
2 ;;1.0;PCE PATIENT CARE ENCOUNTER;**26**;Aug 12, 1996
3CHIKOUT(ENCOWNTR,DFN,LOC,APTDT) ;Edit check-out date/time
4 ; Input - ENCOWNTR - ien of ^SCE(DA,0)
5 ; ENCOWNTR optional if DFN,LOC,APTDT params used
6 ; DFN - ien of ^DPT(DFN, (only used if no ENCOWNTR)
7 ; LOC - ien of ^SC(LOC, (only used if no ENCOWNTR)
8 ; APTDT - Appointment Date/time (only used if no ENCOWNTR)
9 ; Output - PXCHKOUT = Check out Date/time (-1 if not found or allowed)
10 ; External References: ^SCE(DA,0)
11 ; ^SC(DA(2),"S",DA(1),1,DA,"C")
12 ; ^SC(DA,0)
13 N I,XC,X0,ORG,DA,DEF,DEFX,DUOUT,DTOUT,DIRUT,DIROUT S PXCHKOUT=-1
14 I $G(ENCOWNTR) Q:'$G(^SCE(+ENCOWNTR,0)) N APTDT,DFN,LOC,END S END=0,X0=^(0) D Q:END G ON
15 . S APTDT=+X0,DFN=$P(X0,"^",2),LOC=$P(X0,"^",4),ORG=$P(X0,"^",8),DA=$P(X0,"^",9)
16 . I ORG'=1 W !!,$C(7),">>> Only appointments have a check out date to edit." D PAUSE^PXCEHELP S END=1 Q
17 . I '$P($G(^SC(LOC,"S",APTDT,1,DA,"C")),"^",3) W !!,$C(7),">>> No check out date for this appointment." D PAUSE^PXCEHELP S END=1 Q
18 Q:'$G(DFN) I '$D(^SC(+$G(LOC),"S",+$G(APTDT))) Q ;Invalid input
19 S I=0,DA=0 F S I=$O(^SC(LOC,"S",APTDT,1,I)) Q:I<1 I +^(I,0)=DFN S DA=I Q
20 Q:'DA
21ON ;
22 I APTDT,$P(APTDT,".")>DT W !!,"Check out dates for future appointments not allowed.",!,$C(7) Q
23 S XC=$G(^SC(LOC,"S",APTDT,1,DA,"C")),IDT=$P(XC,"^"),(DEF,DEFX)=$P(XC,"^",3)
24 ;If this is a CHECKED OUT time set the default to it, otherwise set it to NOW
25 I DEF S Y=DEF X ^DD("DD") S DEF=Y
26 E S DEF="NOW"
27AGN S PXCHKOUT=$$READ("DO^::EXTR^","Check out date and time",DEF,"^D HELP^%DTC")
28 S:PXCHKOUT["^" PXCHKOUT=-1 Q
29 I $P(PXCHKOUT,".")>DT W !!,"Check out date cannot be in the future.",!,$C(7) G AGN
30 I +XC,PXCHKOUT<+XC W !!,"Check in date must be before Check out date.",!,$C(7) G AGN
31 Q
32READ(TYPE,PROMPT,DEFAULT,HELP) ; Calls reader, returns response
33 N DIR,DA,X,Y
34 S DIR(0)=TYPE,DIR("A")=PROMPT I $D(DEFAULT) S DIR("B")=DEFAULT
35 I $D(HELP) S DIR("?")=HELP
36 D ^DIR
37 Q Y
38TEST ;Test call to CHIKOUT
39 N PXIFN S PXIFN=0
40 F S PXIFN=$O(^SCE(PXIFN)) Q:PXIFN<1 K PXCHKOUT S DFN=$P(^(PXIFN,0),"^",2) W !!,PXIFN_" "_$P(^DPT(DFN,0),"^") D CHIKOUT(PXIFN) W:$D(PXCHKOUT) !,PXCHKOUT S %=1 W !,"Continue " D YN^DICN Q:%'=1
41 Q
Note: See TracBrowser for help on using the repository browser.