SCMCFTEE ;ALB/ART - PCMM Web CRUD for FTEE History ;02/23/2015
;;5.3;Scheduling;**603**;Aug 13, 1993;Build 79
;
QUIT
;
;Public, Supported ICRs
; #2051 - Database Server API: Lookup Utilities (DIC)
; #2053 - Data Base Server API: Editing Utilities (DIE)
; #2056 - Data Base Server API: Data Retriever Utilities (DIQ)
; #10013 - Classic FileMan API: Entry Deletion & File Reindexing (DIK)
; #10060 - NEW PERSON FILE
; #10103 - Kernel Date functions (XLFDT)
;Subscription
;
EN ;
;
QUIT
;
CREATE(SCRET,SCPHIEN,SCHSTDT,SCVALUE,SCDUZ) ; Create/Add a Position Assignment History FTEE History Record
;Inputs: SCRET - return data - passed by reference
; SCPHIEN - Position Assignment History Record IEN
; SCHSTDT - History Date
; SCVALUE - FTEE Value
; SCDUZ - User DUZ
;Output: populated SCRET -
;
IF $GET(SCPHIEN)="" DO QUIT
. SET SCRET="0^Missing record IEN"
;
IF $GET(SCHSTDT)="" DO
. SET SCHSTDT=$$NOW^XLFDT()
;
NEW SCNAME
SET SCNAME="SCMC,APPLICATION PROXY"
IF $GET(SCDUZ)="" DO
. SET SCDUZ=$$FIND1^DIC(200,"","BX",SCNAME,"","","")
;
NEW SCIENS,SCFDA,SCFDAI,SCERR,DIERR
;add sub rec
SET SCIENS="+1,"_SCPHIEN_","
SET SCFDA(404.521,SCIENS,.01)=$GET(SCHSTDT) ;History Date
SET SCFDA(404.521,SCIENS,.02)=$GET(SCVALUE) ;FTEE Value
SET SCFDA(404.521,SCIENS,.03)=$GET(SCDUZ) ;User DUZ
DO UPDATE^DIE("","SCFDA","SCFDAI","SCERR")
IF '$DATA(DIERR) DO
. SET SCRET=SCFDAI(1)
ELSE DO
. SET SCRET="0^Error creating FTEE history record"
;
QUIT
;
READ(SCRET,SCPHIEN,SCFTIEN) ; Read a Position Assignment History FTEE History Record
;Inputs: SCRET - return data - passed by reference
; SCPHIEN - Position Assignment History Record IEN
; SCFTIEN - FTEE History Sub-Record IEN
;Output: populated SCRET - ien^history date^ftee value^user ien(duz)
;
IF $GET(SCPHIEN)="" DO QUIT
. SET SCRET="0^Missing record IEN"
IF $GET(SCFTIEN)="" DO QUIT
. SET SCRET="0^Missing FTEE record IEN"
;
NEW SCIENS,SCHSTDT,SCVALUE,SCDUZ
SET SCIENS=SCFTIEN_","_SCPHIEN_","
SET SCHSTDT=$$GET1^DIQ(404.521,SCIENS,.01,"I") ;History Date
SET SCVALUE=$$GET1^DIQ(404.521,SCIENS,.02,"I") ;FTEE Value
SET SCDUZ=$$GET1^DIQ(404.521,SCIENS,.03,"I") ;User DUZ
SET SCRET=SCFTIEN_U_SCHSTDT_U_SCVALUE_U_SCDUZ
;
QUIT
;
READALL(SCRET,SCPHIEN) ; Read Position Assignment History FTEE History Records
;Inputs: SCRET - return data - passed by reference
; SCPHIEN - Position Assignment History Record IEN
;Output: populated SCRET - array of: ien^history date^ftee value^user ien(duz)
;
IF $GET(SCPHIEN)="" DO QUIT
. SET SCRET(0)="0^Missing record IEN"
;
NEW SCIENS,SCFTIEN,SCHSTDT,SCVALUE,SCDUZ,SCI
;
SET SCI=1
SET SCFTIEN=0
FOR SET SCFTIEN=$ORDER(^SCTM(404.52,SCPHIEN,1,SCFTIEN)) QUIT:+SCFTIEN=0 DO
. SET SCIENS=SCFTIEN_","_SCPHIEN_","
. SET SCHSTDT=$$GET1^DIQ(404.521,SCIENS,.01,"I") ;History Date
. SET SCVALUE=$$GET1^DIQ(404.521,SCIENS,.02,"I") ;FTEE Value
. SET SCDUZ=$$GET1^DIQ(404.521,SCIENS,.03,"I") ;User DUZ
. SET SCRET(SCI)=SCFTIEN_U_SCHSTDT_U_SCVALUE_U_SCDUZ
. SET SCI=SCI+1
SET SCRET(0)=SCI-1
;
QUIT
;
UPDATE(SCRET,SCPHIEN,SCFTIEN,SCHSTDT,SCVALUE,SCDUZ) ; Update a Position Assignment History FTEE History Record
;Inputs: SCRET - return data - passed by reference
; SCPHIEN - Position Assignment History Record IEN
; SCFTIEN - FTEE History Sub-Record IEN
; SCHSTDT - History Date
; SCVALUE - FTEE Value
; SCDUZ - User DUZ
;Output: populated SCRET -
;
IF $GET(SCPHIEN)="" DO QUIT
. SET SCRET="0^Missing record IEN"
IF $GET(SCFTIEN)="" DO QUIT
. SET SCRET="0^Missing FTEE record IEN"
;
NEW SCIENS,SCFDA,SCERR,SCGO
SET SCGO=0
;
SET SCIENS=SCFTIEN_","_SCPHIEN_","
SET SCFDA(404.521,SCIENS,.01)=$GET(SCHSTDT) ;History Date
SET SCFDA(404.521,SCIENS,.02)=$GET(SCVALUE) ;FTEE Value
SET SCFDA(404.521,SCIENS,.03)=$GET(SCDUZ) ;User DUZ
DO FILE^DIE("K","SCFDA","SCERR")
IF '$DATA(DIERR) DO
. SET SCRET=1
ELSE DO
. SET SCRET="0^Error updating FTEE history record"
;
QUIT
;
DELETE(SCRET,SCPHIEN,SCFTIEN) ; Delete a Position Assignment History FTEE History Record
;Inputs: SCRET - return code - passed by reference
; SCPHIEN - Position Assignment History Record IEN
; SCFTIEN - FTEE History Sub-Record IEN
;Output: populated SCRET - defaults to 1 (there is no return code from ^DIK)
;
IF $GET(SCPHIEN)="" DO QUIT
. SET SCRET="0^Missing record IEN"
IF $GET(SCFTIEN)="" DO QUIT
. SET SCRET="0^Missing FTEE record IEN"
;
NEW DIK,DA
SET DIK="^SCTM(404.52,"_SCPHIEN_",1,"
SET DA=SCFTIEN
SET DA(1)=SCPHIEN
DO ^DIK
SET SCRET=1
QUIT
;
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HSCMCFTEE 4749 printed Dec 13, 2024@02:40:18 Page 2
SCMCFTEE ;ALB/ART - PCMM Web CRUD for FTEE History ;02/23/2015
+1 ;;5.3;Scheduling;**603**;Aug 13, 1993;Build 79
+2 ;
+3 QUIT
+4 ;
+5 ;Public, Supported ICRs
+6 ; #2051 - Database Server API: Lookup Utilities (DIC)
+7 ; #2053 - Data Base Server API: Editing Utilities (DIE)
+8 ; #2056 - Data Base Server API: Data Retriever Utilities (DIQ)
+9 ; #10013 - Classic FileMan API: Entry Deletion & File Reindexing (DIK)
+10 ; #10060 - NEW PERSON FILE
+11 ; #10103 - Kernel Date functions (XLFDT)
+12 ;Subscription
+13 ;
EN ;
+1 ;
+2 QUIT
+3 ;
CREATE(SCRET,SCPHIEN,SCHSTDT,SCVALUE,SCDUZ) ; Create/Add a Position Assignment History FTEE History Record
+1 ;Inputs: SCRET - return data - passed by reference
+2 ; SCPHIEN - Position Assignment History Record IEN
+3 ; SCHSTDT - History Date
+4 ; SCVALUE - FTEE Value
+5 ; SCDUZ - User DUZ
+6 ;Output: populated SCRET -
+7 ;
+8 IF $GET(SCPHIEN)=""
Begin DoDot:1
+9 SET SCRET="0^Missing record IEN"
End DoDot:1
QUIT
+10 ;
+11 IF $GET(SCHSTDT)=""
Begin DoDot:1
+12 SET SCHSTDT=$$NOW^XLFDT()
End DoDot:1
+13 ;
+14 NEW SCNAME
+15 SET SCNAME="SCMC,APPLICATION PROXY"
+16 IF $GET(SCDUZ)=""
Begin DoDot:1
+17 SET SCDUZ=$$FIND1^DIC(200,"","BX",SCNAME,"","","")
End DoDot:1
+18 ;
+19 NEW SCIENS,SCFDA,SCFDAI,SCERR,DIERR
+20 ;add sub rec
+21 SET SCIENS="+1,"_SCPHIEN_","
+22 ;History Date
SET SCFDA(404.521,SCIENS,.01)=$GET(SCHSTDT)
+23 ;FTEE Value
SET SCFDA(404.521,SCIENS,.02)=$GET(SCVALUE)
+24 ;User DUZ
SET SCFDA(404.521,SCIENS,.03)=$GET(SCDUZ)
+25 DO UPDATE^DIE("","SCFDA","SCFDAI","SCERR")
+26 IF '$DATA(DIERR)
Begin DoDot:1
+27 SET SCRET=SCFDAI(1)
End DoDot:1
+28 IF '$TEST
Begin DoDot:1
+29 SET SCRET="0^Error creating FTEE history record"
End DoDot:1
+30 ;
+31 QUIT
+32 ;
READ(SCRET,SCPHIEN,SCFTIEN) ; Read a Position Assignment History FTEE History Record
+1 ;Inputs: SCRET - return data - passed by reference
+2 ; SCPHIEN - Position Assignment History Record IEN
+3 ; SCFTIEN - FTEE History Sub-Record IEN
+4 ;Output: populated SCRET - ien^history date^ftee value^user ien(duz)
+5 ;
+6 IF $GET(SCPHIEN)=""
Begin DoDot:1
+7 SET SCRET="0^Missing record IEN"
End DoDot:1
QUIT
+8 IF $GET(SCFTIEN)=""
Begin DoDot:1
+9 SET SCRET="0^Missing FTEE record IEN"
End DoDot:1
QUIT
+10 ;
+11 NEW SCIENS,SCHSTDT,SCVALUE,SCDUZ
+12 SET SCIENS=SCFTIEN_","_SCPHIEN_","
+13 ;History Date
SET SCHSTDT=$$GET1^DIQ(404.521,SCIENS,.01,"I")
+14 ;FTEE Value
SET SCVALUE=$$GET1^DIQ(404.521,SCIENS,.02,"I")
+15 ;User DUZ
SET SCDUZ=$$GET1^DIQ(404.521,SCIENS,.03,"I")
+16 SET SCRET=SCFTIEN_U_SCHSTDT_U_SCVALUE_U_SCDUZ
+17 ;
+18 QUIT
+19 ;
READALL(SCRET,SCPHIEN) ; Read Position Assignment History FTEE History Records
+1 ;Inputs: SCRET - return data - passed by reference
+2 ; SCPHIEN - Position Assignment History Record IEN
+3 ;Output: populated SCRET - array of: ien^history date^ftee value^user ien(duz)
+4 ;
+5 IF $GET(SCPHIEN)=""
Begin DoDot:1
+6 SET SCRET(0)="0^Missing record IEN"
End DoDot:1
QUIT
+7 ;
+8 NEW SCIENS,SCFTIEN,SCHSTDT,SCVALUE,SCDUZ,SCI
+9 ;
+10 SET SCI=1
+11 SET SCFTIEN=0
+12 FOR
SET SCFTIEN=$ORDER(^SCTM(404.52,SCPHIEN,1,SCFTIEN))
if +SCFTIEN=0
QUIT
Begin DoDot:1
+13 SET SCIENS=SCFTIEN_","_SCPHIEN_","
+14 ;History Date
SET SCHSTDT=$$GET1^DIQ(404.521,SCIENS,.01,"I")
+15 ;FTEE Value
SET SCVALUE=$$GET1^DIQ(404.521,SCIENS,.02,"I")
+16 ;User DUZ
SET SCDUZ=$$GET1^DIQ(404.521,SCIENS,.03,"I")
+17 SET SCRET(SCI)=SCFTIEN_U_SCHSTDT_U_SCVALUE_U_SCDUZ
+18 SET SCI=SCI+1
End DoDot:1
+19 SET SCRET(0)=SCI-1
+20 ;
+21 QUIT
+22 ;
UPDATE(SCRET,SCPHIEN,SCFTIEN,SCHSTDT,SCVALUE,SCDUZ) ; Update a Position Assignment History FTEE History Record
+1 ;Inputs: SCRET - return data - passed by reference
+2 ; SCPHIEN - Position Assignment History Record IEN
+3 ; SCFTIEN - FTEE History Sub-Record IEN
+4 ; SCHSTDT - History Date
+5 ; SCVALUE - FTEE Value
+6 ; SCDUZ - User DUZ
+7 ;Output: populated SCRET -
+8 ;
+9 IF $GET(SCPHIEN)=""
Begin DoDot:1
+10 SET SCRET="0^Missing record IEN"
End DoDot:1
QUIT
+11 IF $GET(SCFTIEN)=""
Begin DoDot:1
+12 SET SCRET="0^Missing FTEE record IEN"
End DoDot:1
QUIT
+13 ;
+14 NEW SCIENS,SCFDA,SCERR,SCGO
+15 SET SCGO=0
+16 ;
+17 SET SCIENS=SCFTIEN_","_SCPHIEN_","
+18 ;History Date
SET SCFDA(404.521,SCIENS,.01)=$GET(SCHSTDT)
+19 ;FTEE Value
SET SCFDA(404.521,SCIENS,.02)=$GET(SCVALUE)
+20 ;User DUZ
SET SCFDA(404.521,SCIENS,.03)=$GET(SCDUZ)
+21 DO FILE^DIE("K","SCFDA","SCERR")
+22 IF '$DATA(DIERR)
Begin DoDot:1
+23 SET SCRET=1
End DoDot:1
+24 IF '$TEST
Begin DoDot:1
+25 SET SCRET="0^Error updating FTEE history record"
End DoDot:1
+26 ;
+27 QUIT
+28 ;
DELETE(SCRET,SCPHIEN,SCFTIEN) ; Delete a Position Assignment History FTEE History Record
+1 ;Inputs: SCRET - return code - passed by reference
+2 ; SCPHIEN - Position Assignment History Record IEN
+3 ; SCFTIEN - FTEE History Sub-Record IEN
+4 ;Output: populated SCRET - defaults to 1 (there is no return code from ^DIK)
+5 ;
+6 IF $GET(SCPHIEN)=""
Begin DoDot:1
+7 SET SCRET="0^Missing record IEN"
End DoDot:1
QUIT
+8 IF $GET(SCFTIEN)=""
Begin DoDot:1
+9 SET SCRET="0^Missing FTEE record IEN"
End DoDot:1
QUIT
+10 ;
+11 NEW DIK,DA
+12 SET DIK="^SCTM(404.52,"_SCPHIEN_",1,"
+13 SET DA=SCFTIEN
+14 SET DA(1)=SCPHIEN
+15 DO ^DIK
+16 SET SCRET=1
+17 QUIT
+18 ;