source: FOIAVistA/trunk/r/SCHEDULING-SD-SC/SCAPMC22.m@ 1267

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

initial load of FOIAVistA 6/30/08 version

File size: 3.0 KB
Line 
1SCAPMC22 ;ALB/REW - Team API's ; December 1, 1995
2 ;;5.3;Scheduling;**41,148**;AUG 13, 1993
3 ;;1.0
4INPTTP(DFN,SCPTTPA,SCINACT,SCERR) ;inactivate patient from a position (pt tm pos assgn - #404.43
5 ; input:
6 ; DFN = pointer to PATIENT file (#2)
7 ; SCPTTPA = pointer to pt team assign file (#404.43)
8 ; SCINACT = date to inactivate [default=DT]
9 ; SCERR = array NAME to store error messages.
10 ; [ex. ^TMP("ORXX",$J)]
11 ;
12 ; Output:
13 ; SCOK = 1 if inactivation entry made to file 404.43, 0 ow
14 ; SCERR() = Array of DIALOG file messages(errors) .
15 ; Foramt:
16 ; @SCERR@(0)=Number of erros, undefined if none
17 ; Subscript: Sequential # from 1 to n
18 ; Piece Description
19 ; 1 IEN of DIALOG file
20 N SCTP,SC,SCPARM,SCESEQ,SCLSEQ,SCOK,SCND
21 S SCOK=0
22 G:'$$OKDATA APTTPQ ;setup/check variables
23 S SCND=$G(^SCPT(404.43,SCPTTPA,0))
24 G:SCINACT<$P(SCND,U,3) APTTPQ
25 S SCTP=+$P(SCND,U,2)
26 IF '$$PTTPACT(DFN,SCTP,SCINACT,.SCERR) D G APTTPQ
27 .S SCOK=0
28 .S SCPARM("INACTIVE DATE")=SCINACT
29 .S SCPARM("MESSAGE")="Patient not assigned to position on date"
30 .D ERR^SCAPMCU1(SCESEQ,4044201,.SCPARM,"",.SCERR)
31 ELSE D
32 .S SCOK=1
33 .S SC($J,404.43,SCPTTPA_",",.04)=SCINACT
34 .S SC($J,404.43,SCPTTPA_",",.08)=$G(DUZ,.5)
35 .D NOW^%DTC
36 .S SC($J,404.43,SCPTTPA_",",.09)=%
37 .D UPDATE^DIE("","SC($J)","SCIEN",.SCERR)
38 .I $D(@SCERR@("DIERR")) S SCOK=0
39APTTPQ Q SCOK
40 ;
41PTTPACT(DFN,SCTP,SCDT,SCERR) ;is patient assigned to a position on a given date-time?
42 N SCPTDTS,SCTPLST,SCOK,SCTM
43 S SCTM=$P($G(^SCTM(404.57,SCTP,0)),U,2)
44 S SCOK=0
45 S (SCPTDTS("BEGIN"),SCPTDTS("END"))=SCDT
46 IF $$TPPT^SCAPMC23(DFN,"SCPTDTS",,,,,0,"SCTPLST",.SCERR) S:$D(SCTPLST("SCTP",SCTM,SCTP)) SCOK=1
47 Q SCOK
48 ;
49OKDATA() ;check/setup variables - return 1 if ok/0 if error
50 N SCOK
51 S SCOK=1
52 D INIT^SCAPMCU1(.SCOK)
53 IF '$D(^DPT(DFN,0))!('$D(^SCPT(404.43,SCPTTPA,0))) D S SCOK=0
54 . S SCPARM("PATIENT")=$G(DFN,"Undefined")
55 . S SCPARM("Pt POSITION Asnt")=$G(SCPTTPA,"Undefined")
56 . D ERR^SCAPMCU1(SCESEQ,4045101,.SCPARM,"",.SCERR)
57 S:'$G(SCACT) SCACT=DT
58 S:'$G(SCINACT) SCINACT=DT
59 Q SCOK
60 ;
61INPTSCTP(DFN,SCTP,SCINACT,SCERR) ;inactivate patient from a position - using last pt position assignment - Note: This uses pointer to 404.57 (position) not 404.43 as input
62 ; input:
63 ; DFN = pointer to PATIENT file (#2)
64 ; SCTP = pointer to POSITION file (#404.57)
65 ; SCINACT = date to inactivate [default=DT]
66 ; SCERR = array NAME to store error messages.
67 ; [ex. ^TMP("ORXX",$J)]
68 ;
69 ; Output:
70 ; SCOK = 1 if inactivation entry made to file 404.42, 0 ow
71 ; SCERR() = Array of DIALOG file messages(errors) .
72 ; Foramt:
73 ; @SCERR@(0)=Number of erros, undefined if none
74 ; Subscript: Sequential # from 1 to n
75 ; Piece Description
76 ; 1 IEN of DIALOG file
77 ;
78 N SCACT
79 S SCACT=+$O(^SCPT(404.43,"ADFN",DFN,SCTP,""),-1)
80 S SCPTTP=+$O(^SCPT(404.43,"ADFN",DFN,SCTP,SCACT,0))
81 Q $$INPTTP(.DFN,.SCPTTP,.SCINACT,.SCERR)
Note: See TracBrowser for help on using the repository browser.