RMPR9PU ;HOIFO/HNC/SPS - PURCHASE ORDER CONROL PROCESSING-REMOTE PROCEDURE ;9/8/03 07:12
;;3.0;PROSTHETICS;**75,60**;Feb 09, 1996;Build 18
;
;CLONED AND EDITED FROM RMPR9DO TO SEPERATE DELAYED ORDER REPORT
;
EN(RESULT,DUZ,START,STOP,SITE,SORT,DATE,RMPRPRSN) ; -- Broker callback to get list to display
;entry to send to PCM, WHAT=ALL or S for Summary Only
;RMPRPRSN=P for Purchasing D for Delayed Order Report
S (WHO,RMPRSC)=""
I RMPRPRSN="P" S RMPRSC=$O(^RMPR(669.9,"PA",DUZ,RMPRSC)) Q:(RMPRSC="")!(WHO'="") D
. I '$D(^RMPR(669.9,RMPRSC,0)) Q
. I '$D(^RMPR(669.9,RMPRSC,5,"B",DUZ)) Q
. S WHO=$O(^RMPR(669.9,RMPRSC,5,"B",DUZ,""))
. I START="" S START=$P(^RMPR(669.9,RMPRSC,5,WHO,0),U,2)
. I STOP="" S STOP=$P(^RMPR(669.9,RMPRSC,5,WHO,0),U,3)
A2 N STRING,CLREND,COLUMN,ON,OFF
Q:SORT=""
Q:DATE=""
Q:START=""
Q:STOP=""
Q:SITE=""
I SITE'="ALL" S SITE=$P(^RMPR(669.9,SITE,0),U,2)
K ^TMP($J)
N RMPRA,CDATE,X
K ADATE,PDAY,RMPRCD
S VALMCNT=0,RRX=""
;if sort for open or pending include all regardless of date
;if sort for cancelled or closed include from date passed forward
;
;PPD# status=pending before date, total days create to 1st action
;MHD# manual totals days create to 1st action
;CHD# consult totals days create to 1st action
;PPDD# status=pending before date, total days in pending state, 1st
; action to current date
;
S (LINE,MHD1,MHD2,MHD3,MHD4,MHD5,CHD1,CHD2,CHD3,CHD4,CHD5,CLNK,MLNK)=0
S (PPDAY,PPD,PPD1,PPD2,PPD3,PPD4,PPD5)=0
S (PPDDAY,PPDD1,PPDD2,PPDD3,PPDD4,PPDD5)=0
I SORT["O"!(SORT["P") D ALL
I SORT["C"!(SORT["X") D DTFWD
S ^TMP($J,"A1")="^^^^^^^^"_MHD1_U_MHD2_U_MHD3_U_MHD4_U_MHD5_"^^^^"_MLNK_U_0
S ^TMP($J,"A2")="^^^^^^^^"_CHD1_U_CHD2_U_CHD3_U_CHD4_U_CHD5_"^^^^"_CLNK_U_1
S ^TMP($J,"A3")="^^^^^^^^"_PPDD1_U_PPDD2_U_PPDD3_U_PPDD4_U_PPDD5_"^^^^^"_2
S ^TMP($J,"A4")="^^^^^^^^"_PPD1_U_PPD2_U_PPD3_U_PPD4_U_PPD5_"^^^^^"_3
G EXIT
Q
ALL ;all open pending records regardless of date passed
S RMPRI1=0
F RMPRI1=START:1:STOP D
.I $L(RMPRI1)=1 S RMPRI=0_RMPRI1
.E S RMPRI=RMPRI1
.S RMPRST=""
.F S RMPRST=$O(^RMPR(668,"L1",RMPRI,RMPRST)) Q:RMPRST="" D
. .Q:RMPRST="X"
. .Q:RMPRST="C"
. .I SORT'["P"&(RMPRST="P") Q
. .S RMPRA=0
. .F S RMPRA=$O(^RMPR(668,"L1",RMPRI,RMPRST,RMPRA)) Q:RMPRA'>0 D
. . .S STN=$P(^RMPR(668,RMPRA,0),U,7)
. . .I SITE'="ALL"&(SITE'=STN) Q
. . .S STNX=$$STATN^RMPRUTIL(STN)
. . .I $G(WHAT)="S" S VISNX=$P($G(^RMPR(669.9,STN1,"INV")),U,2)
. . .S STS=$P(^RMPR(668,RMPRA,0),U,10)
. . .Q:STS["X"
. . .Q:STS["C"
. . .I SORT'["O"&(STS="O") Q
. . .I SORT'["P"&(STS="P") Q
. . .D REC
Q
DTFWD ;from date passed forward
S RMPRI1=0
F RMPRI1=START:1:STOP D
.I $L(RMPRI1)=1 S RMPRI=0_RMPRI1
.E S RMPRI=RMPRI1
.S RMPRDTM=""
.F S RMPRDTM=$O(^RMPR(668,"L",RMPRI,RMPRDTM)) Q:RMPRDTM="" D
..Q:RMPRDTM=""
..Q:RMPRDTM<DATE
..S RMPRST=""
..F S RMPRST=$O(^RMPR(668,"L",RMPRI,RMPRDTM,RMPRST)) Q:RMPRST="" D
.. .Q:RMPRST="O"
.. .Q:RMPRST="P"
.. .I SORT'["X"&(RMPRST="X") Q
.. .I SORT'["C"&(RMPRST="C") Q
.. .S RMPRA=0
.. .F S RMPRA=$O(^RMPR(668,"L",RMPRI,RMPRDTM,RMPRST,RMPRA)) Q:RMPRA'>0 D
.. . .Q:RMPRA=""
.. . .S STN=$P(^RMPR(668,RMPRA,0),U,7)
.. . .I SITE'="ALL"&(SITE'=STN) Q
.. . .S STNX=$$STATN^RMPRUTIL(STN)
.. . .I $G(WHAT)'="" S VISNX=$P($G(^RMPR(669.9,SITE,"INV")),U,2)
.. . .S STS=$P(^RMPR(668,RMPRA,0),U,10)
.. . .Q:STS["O"
.. . .Q:STS["P"
.. . .I SORT'["C"&(STS="C") Q
.. . .I SORT'["X"&(STS="X") Q
.. . .D REC
S RMPRDTC=$P(DATE,".",1)
F S RMPRDTC=$O(^RMPR(668,"CD",RMPRDTC)) Q:RMPRDTC="" D
.Q:RMPRDTC<DATE
.S RMPRDYS=0
.F S RMPRDYS=$O(^RMPR(668,"CD",RMPRDTC,RMPRDYS)) Q:RMPRDYS="" D
. .Q:RMPRDYS'>5
. .S RMPRA=0
. .F S RMPRA=$O(^RMPR(668,"CD",RMPRDTC,RMPRDYS,RMPRA)) Q:RMPRA'>0 D
. . .;check site
. . .S STN=$P(^RMPR(668,RMPRA,0),U,7)
. . .I SITE'="ALL"&(SITE'=STN) Q
. . .S STNX=$$STATN^RMPRUTIL(STN)
. . .;check status
. . .S STS=$P(^RMPR(668,RMPRA,0),U,10)
. . .I SORT'["O"&(STS="O") Q
. . .I SORT'["P"&(STS="P") Q
. . .I SORT'["C"&(STS="C") Q
. . .I SORT'["X"&(STS="X") Q
. . .;ssn range filter
. . .S DFN=$P(^RMPR(668,RMPRA,0),U,2)
. . .D DEM^VADPT
. . .S SSNEN=$E($P(VADM(2),"^",2),10,11)
. . .I SSNEN>STOP Q
. . .I SSNEN<START Q
. . .K SSNEN,VADM
. . .D REC
Q
REC ;records to grid
;stop date, init action date
;check ien, patch 77
;
Q:$D(^TMP($J,RMPRA))
;
N DIC,DIQ,DR,STOPDT
S DA=RMPRA
S DIC=668,DIQ="RE",DR=10,DIQ(0)="EN" D EN^DIQ1
S STOPDT=$P($G(^RMPR(668,RMPRA,0)),U,9),STOPDT=$$DAT2^RMPRUTL1(STOPDT)
S LINE=LINE+1
S CDATE=$P(^RMPR(668,RMPRA,0),U,1),CDATE=$$DAT2^RMPRUTL1(CDATE)
S DFN=$P(^RMPR(668,RMPRA,0),U,2) Q:DFN=""
N VA,VADM
D DEM^VADPT
S WHO=VADM(1)
S SSN=VADM(2)
D SVC^VADPT
S RMPROEOI=$S(VASV(11)>0:"<!>",VASV(12)>0:"<!>",VASV(13)>0:"<!>",1:0)
D KVAR^VADPT
; Added line below for OIF/OEF field 15 file 668
I RMPROEOI="<!>" S $P(^RMPR(668,RMPRA,7),U,1)=1
;type
S TYPE=$$TYPE^RMPREOU(RMPRA,8)
;display description if manual
S DES=$$DES^RMPREOU(RMPRA,22)
S DES=$TR(DES,"^","*")
S DES=$TR(DES,"""","'")
;init action date
S ADATE="",PDAY="",WRKDAY=""
S ADATE=$P(^RMPR(668,RMPRA,0),U,9)
;PPD=1 for previous pending
I ADATE'="" S (PDAY,WRKDAY)=$$WRKDAY^RMPREOU(RMPRA)
I ADATE="" S (PDAY,WRKDAY)=$$CWRKDAY^RMPREOU(RMPRA)
I ADATE'="" S CDAY=$$PDAY^RMPREOU(RMPRA)
;
S STATUS=$$STATUS^RMPREOU(RMPRA)
I STATUS["PENDING" D
.I ADATE'=""&(ADATE<DATE) S PPD=1
.S PPDAY=$$PWRKDAY^RMPREOU(RMPRA)
S LINKED=$P($G(^RMPR(668,RMPRA,10,0)),U,4)
I LINKED="" S LINKED=0
;
;If work order get ien of 664.1,WO#,Assigned Tech DUZ
S (RMPR6641,RMPRWON)="",RMATECH=""
S RMPR6641=$O(^RMPR(664.1,"SUS",RMPRA,0))
I +RMPR6641>0 S:$D(^RMPR(664.1,RMPR6641,0)) RMATECH=$P(^RMPR(664.1,RMPR6641,0),U,16),RMPRWON=$P(^(0),U,13)
I RMPROEOI="<!>" S WHO=RMPROEOI_WHO
S ^TMP($J,RMPRA)=CDATE_U_WHO_U_SSN_U_TYPE_U_DES_U
;look at pday and parse
S (HD1,HD2,HD3,HD4,HD5,DH6)=""
;SD Working Days in Pending Status
S (SD1,SD2,SD3,SD4,SD5)=0
I (PDAY>0)&(PDAY<6)!(PDAY=0) S HD1=PDAY,DH6="NO"
I (PPDAY>0)&(PPDAY<6)!(PPDAY=0) S SD1=PPDAY
I (PDAY>0)&(PDAY<6)&(TYPE["MANUAL")!(PDAY=0)&(TYPE["MANUAL") S MHD1=MHD1+1
I (PDAY>0)&(PDAY<6)&(TYPE'["MANUAL")!(PDAY=0)&(TYPE'["MANUAL") S CHD1=CHD1+1
I (PPDAY>0)&(PPDAY<6)&(STATUS["PENDING") S PPDD1=PPDD1+1
I (PDAY>0)&(PDAY<6)&(PPD=1) S PPD1=PPD1+1
I HD1="" S HD1=0
I (PDAY>5)&(PDAY<10) S HD2=PDAY,DH6="YES"
I (PPDAY>5)&(PPDAY<10) S SD2=PPDAY
I (PDAY>5)&(PDAY<10)&(TYPE["MANUAL") S MHD2=MHD2+1
I (PDAY>5)&(PDAY<10)&(TYPE'["MANUAL") S CHD2=CHD2+1
I (PPDAY>5)&(PPDAY<10)&(STATUS["PENDING") S PPDD2=PPDD2+1
I (PDAY>5)&(PDAY<10)&(PPD=1) S PPD2=PPD2+1
I HD2="" S HD2=0
I (PDAY>9)&(PDAY<30) S HD3=PDAY,DH6="YES"
I (PPDAY>9)&(PPDAY<30) S SD3=PPDAY
I (PDAY>9)&(PDAY<30)&(TYPE["MANUAL") S MHD3=MHD3+1
I (PDAY>9)&(PDAY<30)&(TYPE'["MANUAL") S CHD3=CHD3+1
I (PPDAY>9)&(PPDAY<30)&(STATUS["PENDING") S PPDD3=PPDD3+1
I (PDAY>9)&(PDAY<30)&(PPD=1) S PPD3=PPD3+1
I HD3="" S HD3=0
I (PDAY>29)&(PDAY<90) S HD4=PDAY,DH6="YES"
I (PPDAY>29)&(PPDAY<90) S SD4=PPDAY
I (PDAY>29)&(PDAY<90)&(TYPE["MANUAL") S MHD4=MHD4+1
I (PDAY>29)&(PDAY<90)&(TYPE'["MANUAL") S CHD4=CHD4+1
I (PPDAY>29)&(PPDAY<90)&(STATUS["PENDING") S PPDD4=PPDD4+1
I (PDAY>29)&(PDAY<90)&(PPD=1) S PPD4=PPD4+1
I HD4="" S HD4=0
I PDAY>89 S HD5=PDAY,DH6="YES"
I PPDAY>89 S SD5=PPDAY
I (PDAY>89)&(TYPE["MANUAL") S MHD5=MHD5+1
I (PDAY>89)&(TYPE'["MANUAL") S CHD5=CHD5+1
I (PPDAY>89)&(STATUS["PENDING") S PPDD5=PPDD5+1
I (PDAY>89)&(PPD=1) S PPD5=PPD5+1
I HD5="" S HD5=0
S (PPD,PPDAY)=0
I LINKED'=0&(TYPE["MANUAL") S MLNK=MLNK+1
I LINKED'=0&(TYPE'["MANUAL") S CLNK=CLNK+1
S ^TMP($J,RMPRA)=^TMP($J,RMPRA)_STOPDT_U_DH6_U_HD1_U_HD2_U_HD3_U_HD4_U_HD5
S ^TMP($J,RMPRA)=^TMP($J,RMPRA)_U_STATUS_U_RMPRA_U_STNX_U_LINKED
S ^TMP($J,RMPRA)=^TMP($J,RMPRA)_U_U_SD1_U_SD2_U_SD3_U_SD4_U_SD5_U_DFN
S ^TMP($J,RMPRA)=^TMP($J,RMPRA)_U_RMPR6641_U_RMPRWON_U_RMATECH
K CDATE,WHO,SSN,TYPE,DES,PDAY,STATUS,ADATE
;PUT RESULTS IN GLOBAL!!
Q
K CDAY,CHD1,CHD2,CHD3,CHD4,CHD5,CLNK,DA,DFN,DH6,HD1,HD2,HD3,HD4,HD5,LINE
K LINKED,MHD1,MHD2,MHD3,MHD4,MHD5,MLNK,PPD,PPD1,PPD2,PPD3,PPD4,PPD5
K PPDAY,PPDD1,PPDD2,PPDD3,PPDD4,PPDD5,PPDDAY,RMPR6641,RMPRDTC,RMPRDTM
K RMPRDYS,RMPRI,RMPRI1,RMPRSC,RMPRST,RMPRWON,RRX,SD1,SD2,SD3,SD4,SD5,STN,STN1,STNX,STS,VALMCNT,VISNX,WHAT,WRKDAY
EXIT ;common exit point
S RESULT=$NA(^TMP($J))
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HRMPR9PU 8517 printed Oct 16, 2024@18:34:24 Page 2
RMPR9PU ;HOIFO/HNC/SPS - PURCHASE ORDER CONROL PROCESSING-REMOTE PROCEDURE ;9/8/03 07:12
+1 ;;3.0;PROSTHETICS;**75,60**;Feb 09, 1996;Build 18
+2 ;
+3 ;CLONED AND EDITED FROM RMPR9DO TO SEPERATE DELAYED ORDER REPORT
+4 ;
EN(RESULT,DUZ,START,STOP,SITE,SORT,DATE,RMPRPRSN) ; -- Broker callback to get list to display
+1 ;entry to send to PCM, WHAT=ALL or S for Summary Only
+2 ;RMPRPRSN=P for Purchasing D for Delayed Order Report
+3 SET (WHO,RMPRSC)=""
+4 IF RMPRPRSN="P"
SET RMPRSC=$ORDER(^RMPR(669.9,"PA",DUZ,RMPRSC))
if (RMPRSC="")!(WHO'="")
QUIT
Begin DoDot:1
+5 IF '$DATA(^RMPR(669.9,RMPRSC,0))
QUIT
+6 IF '$DATA(^RMPR(669.9,RMPRSC,5,"B",DUZ))
QUIT
+7 SET WHO=$ORDER(^RMPR(669.9,RMPRSC,5,"B",DUZ,""))
+8 IF START=""
SET START=$PIECE(^RMPR(669.9,RMPRSC,5,WHO,0),U,2)
+9 IF STOP=""
SET STOP=$PIECE(^RMPR(669.9,RMPRSC,5,WHO,0),U,3)
End DoDot:1
A2 NEW STRING,CLREND,COLUMN,ON,OFF
+1 if SORT=""
QUIT
+2 if DATE=""
QUIT
+3 if START=""
QUIT
+4 if STOP=""
QUIT
+5 if SITE=""
QUIT
+6 IF SITE'="ALL"
SET SITE=$PIECE(^RMPR(669.9,SITE,0),U,2)
+7 KILL ^TMP($JOB)
+8 NEW RMPRA,CDATE,X
+9 KILL ADATE,PDAY,RMPRCD
+10 SET VALMCNT=0
SET RRX=""
+11 ;if sort for open or pending include all regardless of date
+12 ;if sort for cancelled or closed include from date passed forward
+13 ;
+14 ;PPD# status=pending before date, total days create to 1st action
+15 ;MHD# manual totals days create to 1st action
+16 ;CHD# consult totals days create to 1st action
+17 ;PPDD# status=pending before date, total days in pending state, 1st
+18 ; action to current date
+19 ;
+20 SET (LINE,MHD1,MHD2,MHD3,MHD4,MHD5,CHD1,CHD2,CHD3,CHD4,CHD5,CLNK,MLNK)=0
+21 SET (PPDAY,PPD,PPD1,PPD2,PPD3,PPD4,PPD5)=0
+22 SET (PPDDAY,PPDD1,PPDD2,PPDD3,PPDD4,PPDD5)=0
+23 IF SORT["O"!(SORT["P")
DO ALL
+24 IF SORT["C"!(SORT["X")
DO DTFWD
+25 SET ^TMP($JOB,"A1")="^^^^^^^^"_MHD1_U_MHD2_U_MHD3_U_MHD4_U_MHD5_"^^^^"_MLNK_U_0
+26 SET ^TMP($JOB,"A2")="^^^^^^^^"_CHD1_U_CHD2_U_CHD3_U_CHD4_U_CHD5_"^^^^"_CLNK_U_1
+27 SET ^TMP($JOB,"A3")="^^^^^^^^"_PPDD1_U_PPDD2_U_PPDD3_U_PPDD4_U_PPDD5_"^^^^^"_2
+28 SET ^TMP($JOB,"A4")="^^^^^^^^"_PPD1_U_PPD2_U_PPD3_U_PPD4_U_PPD5_"^^^^^"_3
+29 GOTO EXIT
+30 QUIT
ALL ;all open pending records regardless of date passed
+1 SET RMPRI1=0
+2 FOR RMPRI1=START:1:STOP
Begin DoDot:1
+3 IF $LENGTH(RMPRI1)=1
SET RMPRI=0_RMPRI1
+4 IF '$TEST
SET RMPRI=RMPRI1
+5 SET RMPRST=""
+6 FOR
SET RMPRST=$ORDER(^RMPR(668,"L1",RMPRI,RMPRST))
if RMPRST=""
QUIT
Begin DoDot:2
+7 if RMPRST="X"
QUIT
+8 if RMPRST="C"
QUIT
+9 IF SORT'["P"&(RMPRST="P")
QUIT
+10 SET RMPRA=0
+11 FOR
SET RMPRA=$ORDER(^RMPR(668,"L1",RMPRI,RMPRST,RMPRA))
if RMPRA'>0
QUIT
Begin DoDot:3
+12 SET STN=$PIECE(^RMPR(668,RMPRA,0),U,7)
+13 IF SITE'="ALL"&(SITE'=STN)
QUIT
+14 SET STNX=$$STATN^RMPRUTIL(STN)
+15 IF $GET(WHAT)="S"
SET VISNX=$PIECE($GET(^RMPR(669.9,STN1,"INV")),U,2)
+16 SET STS=$PIECE(^RMPR(668,RMPRA,0),U,10)
+17 if STS["X"
QUIT
+18 if STS["C"
QUIT
+19 IF SORT'["O"&(STS="O")
QUIT
+20 IF SORT'["P"&(STS="P")
QUIT
+21 DO REC
End DoDot:3
End DoDot:2
End DoDot:1
+22 QUIT
DTFWD ;from date passed forward
+1 SET RMPRI1=0
+2 FOR RMPRI1=START:1:STOP
Begin DoDot:1
+3 IF $LENGTH(RMPRI1)=1
SET RMPRI=0_RMPRI1
+4 IF '$TEST
SET RMPRI=RMPRI1
+5 SET RMPRDTM=""
+6 FOR
SET RMPRDTM=$ORDER(^RMPR(668,"L",RMPRI,RMPRDTM))
if RMPRDTM=""
QUIT
Begin DoDot:2
+7 if RMPRDTM=""
QUIT
+8 if RMPRDTM<DATE
QUIT
+9 SET RMPRST=""
+10 FOR
SET RMPRST=$ORDER(^RMPR(668,"L",RMPRI,RMPRDTM,RMPRST))
if RMPRST=""
QUIT
Begin DoDot:3
+11 if RMPRST="O"
QUIT
+12 if RMPRST="P"
QUIT
+13 IF SORT'["X"&(RMPRST="X")
QUIT
+14 IF SORT'["C"&(RMPRST="C")
QUIT
+15 SET RMPRA=0
+16 FOR
SET RMPRA=$ORDER(^RMPR(668,"L",RMPRI,RMPRDTM,RMPRST,RMPRA))
if RMPRA'>0
QUIT
Begin DoDot:4
+17 if RMPRA=""
QUIT
+18 SET STN=$PIECE(^RMPR(668,RMPRA,0),U,7)
+19 IF SITE'="ALL"&(SITE'=STN)
QUIT
+20 SET STNX=$$STATN^RMPRUTIL(STN)
+21 IF $GET(WHAT)'=""
SET VISNX=$PIECE($GET(^RMPR(669.9,SITE,"INV")),U,2)
+22 SET STS=$PIECE(^RMPR(668,RMPRA,0),U,10)
+23 if STS["O"
QUIT
+24 if STS["P"
QUIT
+25 IF SORT'["C"&(STS="C")
QUIT
+26 IF SORT'["X"&(STS="X")
QUIT
+27 DO REC
End DoDot:4
End DoDot:3
End DoDot:2
End DoDot:1
+28 SET RMPRDTC=$PIECE(DATE,".",1)
+29 FOR
SET RMPRDTC=$ORDER(^RMPR(668,"CD",RMPRDTC))
if RMPRDTC=""
QUIT
Begin DoDot:1
+30 if RMPRDTC<DATE
QUIT
+31 SET RMPRDYS=0
+32 FOR
SET RMPRDYS=$ORDER(^RMPR(668,"CD",RMPRDTC,RMPRDYS))
if RMPRDYS=""
QUIT
Begin DoDot:2
+33 if RMPRDYS'>5
QUIT
+34 SET RMPRA=0
+35 FOR
SET RMPRA=$ORDER(^RMPR(668,"CD",RMPRDTC,RMPRDYS,RMPRA))
if RMPRA'>0
QUIT
Begin DoDot:3
+36 ;check site
+37 SET STN=$PIECE(^RMPR(668,RMPRA,0),U,7)
+38 IF SITE'="ALL"&(SITE'=STN)
QUIT
+39 SET STNX=$$STATN^RMPRUTIL(STN)
+40 ;check status
+41 SET STS=$PIECE(^RMPR(668,RMPRA,0),U,10)
+42 IF SORT'["O"&(STS="O")
QUIT
+43 IF SORT'["P"&(STS="P")
QUIT
+44 IF SORT'["C"&(STS="C")
QUIT
+45 IF SORT'["X"&(STS="X")
QUIT
+46 ;ssn range filter
+47 SET DFN=$PIECE(^RMPR(668,RMPRA,0),U,2)
+48 DO DEM^VADPT
+49 SET SSNEN=$EXTRACT($PIECE(VADM(2),"^",2),10,11)
+50 IF SSNEN>STOP
QUIT
+51 IF SSNEN<START
QUIT
+52 KILL SSNEN,VADM
+53 DO REC
End DoDot:3
End DoDot:2
End DoDot:1
+54 QUIT
REC ;records to grid
+1 ;stop date, init action date
+2 ;check ien, patch 77
+3 ;
+4 if $DATA(^TMP($JOB,RMPRA))
QUIT
+5 ;
+6 NEW DIC,DIQ,DR,STOPDT
+7 SET DA=RMPRA
+8 SET DIC=668
SET DIQ="RE"
SET DR=10
SET DIQ(0)="EN"
DO EN^DIQ1
+9 SET STOPDT=$PIECE($GET(^RMPR(668,RMPRA,0)),U,9)
SET STOPDT=$$DAT2^RMPRUTL1(STOPDT)
+10 SET LINE=LINE+1
+11 SET CDATE=$PIECE(^RMPR(668,RMPRA,0),U,1)
SET CDATE=$$DAT2^RMPRUTL1(CDATE)
+12 SET DFN=$PIECE(^RMPR(668,RMPRA,0),U,2)
if DFN=""
QUIT
+13 NEW VA,VADM
+14 DO DEM^VADPT
+15 SET WHO=VADM(1)
+16 SET SSN=VADM(2)
+17 DO SVC^VADPT
+18 SET RMPROEOI=$SELECT(VASV(11)>0:"<!>",VASV(12)>0:"<!>",VASV(13)>0:"<!>",1:0)
+19 DO KVAR^VADPT
+20 ; Added line below for OIF/OEF field 15 file 668
+21 IF RMPROEOI="<!>"
SET $PIECE(^RMPR(668,RMPRA,7),U,1)=1
+22 ;type
+23 SET TYPE=$$TYPE^RMPREOU(RMPRA,8)
+24 ;display description if manual
+25 SET DES=$$DES^RMPREOU(RMPRA,22)
+26 SET DES=$TRANSLATE(DES,"^","*")
+27 SET DES=$TRANSLATE(DES,"""","'")
+28 ;init action date
+29 SET ADATE=""
SET PDAY=""
SET WRKDAY=""
+30 SET ADATE=$PIECE(^RMPR(668,RMPRA,0),U,9)
+31 ;PPD=1 for previous pending
+32 IF ADATE'=""
SET (PDAY,WRKDAY)=$$WRKDAY^RMPREOU(RMPRA)
+33 IF ADATE=""
SET (PDAY,WRKDAY)=$$CWRKDAY^RMPREOU(RMPRA)
+34 IF ADATE'=""
SET CDAY=$$PDAY^RMPREOU(RMPRA)
+35 ;
+36 SET STATUS=$$STATUS^RMPREOU(RMPRA)
+37 IF STATUS["PENDING"
Begin DoDot:1
+38 IF ADATE'=""&(ADATE<DATE)
SET PPD=1
+39 SET PPDAY=$$PWRKDAY^RMPREOU(RMPRA)
End DoDot:1
+40 SET LINKED=$PIECE($GET(^RMPR(668,RMPRA,10,0)),U,4)
+41 IF LINKED=""
SET LINKED=0
+42 ;
+43 ;If work order get ien of 664.1,WO#,Assigned Tech DUZ
+44 SET (RMPR6641,RMPRWON)=""
SET RMATECH=""
+45 SET RMPR6641=$ORDER(^RMPR(664.1,"SUS",RMPRA,0))
+46 IF +RMPR6641>0
if $DATA(^RMPR(664.1,RMPR6641,0))
SET RMATECH=$PIECE(^RMPR(664.1,RMPR6641,0),U,16)
SET RMPRWON=$PIECE(^(0),U,13)
+47 IF RMPROEOI="<!>"
SET WHO=RMPROEOI_WHO
+48 SET ^TMP($JOB,RMPRA)=CDATE_U_WHO_U_SSN_U_TYPE_U_DES_U
+49 ;look at pday and parse
+50 SET (HD1,HD2,HD3,HD4,HD5,DH6)=""
+51 ;SD Working Days in Pending Status
+52 SET (SD1,SD2,SD3,SD4,SD5)=0
+53 IF (PDAY>0)&(PDAY<6)!(PDAY=0)
SET HD1=PDAY
SET DH6="NO"
+54 IF (PPDAY>0)&(PPDAY<6)!(PPDAY=0)
SET SD1=PPDAY
+55 IF (PDAY>0)&(PDAY<6)&(TYPE["MANUAL")!(PDAY=0)&(TYPE["MANUAL")
SET MHD1=MHD1+1
+56 IF (PDAY>0)&(PDAY<6)&(TYPE'["MANUAL")!(PDAY=0)&(TYPE'["MANUAL")
SET CHD1=CHD1+1
+57 IF (PPDAY>0)&(PPDAY<6)&(STATUS["PENDING")
SET PPDD1=PPDD1+1
+58 IF (PDAY>0)&(PDAY<6)&(PPD=1)
SET PPD1=PPD1+1
+59 IF HD1=""
SET HD1=0
+60 IF (PDAY>5)&(PDAY<10)
SET HD2=PDAY
SET DH6="YES"
+61 IF (PPDAY>5)&(PPDAY<10)
SET SD2=PPDAY
+62 IF (PDAY>5)&(PDAY<10)&(TYPE["MANUAL")
SET MHD2=MHD2+1
+63 IF (PDAY>5)&(PDAY<10)&(TYPE'["MANUAL")
SET CHD2=CHD2+1
+64 IF (PPDAY>5)&(PPDAY<10)&(STATUS["PENDING")
SET PPDD2=PPDD2+1
+65 IF (PDAY>5)&(PDAY<10)&(PPD=1)
SET PPD2=PPD2+1
+66 IF HD2=""
SET HD2=0
+67 IF (PDAY>9)&(PDAY<30)
SET HD3=PDAY
SET DH6="YES"
+68 IF (PPDAY>9)&(PPDAY<30)
SET SD3=PPDAY
+69 IF (PDAY>9)&(PDAY<30)&(TYPE["MANUAL")
SET MHD3=MHD3+1
+70 IF (PDAY>9)&(PDAY<30)&(TYPE'["MANUAL")
SET CHD3=CHD3+1
+71 IF (PPDAY>9)&(PPDAY<30)&(STATUS["PENDING")
SET PPDD3=PPDD3+1
+72 IF (PDAY>9)&(PDAY<30)&(PPD=1)
SET PPD3=PPD3+1
+73 IF HD3=""
SET HD3=0
+74 IF (PDAY>29)&(PDAY<90)
SET HD4=PDAY
SET DH6="YES"
+75 IF (PPDAY>29)&(PPDAY<90)
SET SD4=PPDAY
+76 IF (PDAY>29)&(PDAY<90)&(TYPE["MANUAL")
SET MHD4=MHD4+1
+77 IF (PDAY>29)&(PDAY<90)&(TYPE'["MANUAL")
SET CHD4=CHD4+1
+78 IF (PPDAY>29)&(PPDAY<90)&(STATUS["PENDING")
SET PPDD4=PPDD4+1
+79 IF (PDAY>29)&(PDAY<90)&(PPD=1)
SET PPD4=PPD4+1
+80 IF HD4=""
SET HD4=0
+81 IF PDAY>89
SET HD5=PDAY
SET DH6="YES"
+82 IF PPDAY>89
SET SD5=PPDAY
+83 IF (PDAY>89)&(TYPE["MANUAL")
SET MHD5=MHD5+1
+84 IF (PDAY>89)&(TYPE'["MANUAL")
SET CHD5=CHD5+1
+85 IF (PPDAY>89)&(STATUS["PENDING")
SET PPDD5=PPDD5+1
+86 IF (PDAY>89)&(PPD=1)
SET PPD5=PPD5+1
+87 IF HD5=""
SET HD5=0
+88 SET (PPD,PPDAY)=0
+89 IF LINKED'=0&(TYPE["MANUAL")
SET MLNK=MLNK+1
+90 IF LINKED'=0&(TYPE'["MANUAL")
SET CLNK=CLNK+1
+91 SET ^TMP($JOB,RMPRA)=^TMP($JOB,RMPRA)_STOPDT_U_DH6_U_HD1_U_HD2_U_HD3_U_HD4_U_HD5
+92 SET ^TMP($JOB,RMPRA)=^TMP($JOB,RMPRA)_U_STATUS_U_RMPRA_U_STNX_U_LINKED
+93 SET ^TMP($JOB,RMPRA)=^TMP($JOB,RMPRA)_U_U_SD1_U_SD2_U_SD3_U_SD4_U_SD5_U_DFN
+94 SET ^TMP($JOB,RMPRA)=^TMP($JOB,RMPRA)_U_RMPR6641_U_RMPRWON_U_RMATECH
+95 KILL CDATE,WHO,SSN,TYPE,DES,PDAY,STATUS,ADATE
+96 ;PUT RESULTS IN GLOBAL!!
+97 QUIT
+98 KILL CDAY,CHD1,CHD2,CHD3,CHD4,CHD5,CLNK,DA,DFN,DH6,HD1,HD2,HD3,HD4,HD5,LINE
+99 KILL LINKED,MHD1,MHD2,MHD3,MHD4,MHD5,MLNK,PPD,PPD1,PPD2,PPD3,PPD4,PPD5
+100 KILL PPDAY,PPDD1,PPDD2,PPDD3,PPDD4,PPDD5,PPDDAY,RMPR6641,RMPRDTC,RMPRDTM
+101 KILL RMPRDYS,RMPRI,RMPRI1,RMPRSC,RMPRST,RMPRWON,RRX,SD1,SD2,SD3,SD4,SD5,STN,STN1,STNX,STS,VALMCNT,VISNX,WHAT,WRKDAY
EXIT ;common exit point
+1 SET RESULT=$NAME(^TMP($JOB))
+2 QUIT