PSXCSLOG ;BIR/JMB-Checks for Active Cost Tasks Before Queuing/View Cost Task Log ;[ 04/08/97 2:06 PM ]
;;2.0;CMOP;;11 Apr 97
CHECK ;Looks for jobs queued or running for same or overlapping date range.
Q:'$D(^PSX(554,"ARUN")) K PSXLOC S $P(PSXSLN,"-",80)=""
F PSXSTA=-1:0 S PSXSTA=$O(^PSX(554,"ARUN",PSXSTA)) Q:PSXSTA="" F PSXIEN=0:0 S PSXIEN=$O(^PSX(554,"ARUN",PSXSTA,PSXIEN)) Q:'PSXIEN D
.Q:'$D(^PSX(554,1,2,PSXIEN,0))
.I PSXBDT'<$P(^PSX(554,1,2,PSXIEN,0),"^",3)&(PSXEDT'>$P(^PSX(554,1,2,PSXIEN,0),"^",4)) S PSXLOC(PSXIEN)="" Q
.I PSXBDT'>$P(^PSX(554,1,2,PSXIEN,0),"^",3)&(PSXEDT'>$P(^PSX(554,1,2,PSXIEN,0),"^",4))&(PSXEDT'<$P(^PSX(554,1,2,PSXIEN,0),"^",3)) S PSXLOC(PSXIEN)="" Q
.I PSXBDT'<$P(^PSX(554,1,2,PSXIEN,0),"^",3)&(PSXBDT'>$P(^PSX(554,1,2,PSXIEN,0),"^",4))&(PSXEDT'<$P(^PSX(554,1,2,PSXIEN,0),"^",4)) S PSXLOC(PSXIEN)="" Q
.I PSXBDT'<$P(^PSX(554,1,2,PSXIEN,0),"^",3)&(PSXEDT'>$P(^PSX(554,1,2,PSXIEN,0),"^",4)) S PSXLOC(PSXIEN)="" Q
.Q:+$G(PSXCOM)
.S PSXBDTE=$E($P(^PSX(554,1,2,PSXIEN,0),"^",3),1,5),PSXEDTE=$E($P(^PSX(554,1,2,PSXIEN,0),"^",4),1,5)
.I ($E(PSXBDT,1,5)'<PSXBDTE&($E(PSXBDT,1,5)'>PSXEDTE))!($E(PSXEDT,1,5)'<PSXBDTE&($E(PSXEDT,1,5)'>PSXEDTE)) S PSXLOC(PSXIEN)="" W !,"OH NO!"
Q:'$O(PSXLOC(0))
;Error msg
W !!,"Your task cannot be queued. The following active task(s) is for the same",!,"date range you have selected or for dates that overlap your date range.",!! S PSXERR=1,$P(PSXSLN,"-",57)=""
W "Status Activity Data Date Range Task# Task Started",!,PSXSLN
F PSXIEN=0:0 S PSXIEN=$O(PSXLOC(PSXIEN)) Q:'PSXIEN D DISP
Q
VIEW ;Displays cost entries in 554
I '$O(^PSX(554,1,2,0)) W !!,"There are no cost entries in the CMOP OPERATIONS file." G EXIT
S $P(PSXSLN,"-",80)="",(PSXOUT,PSXPAGE)=0,PSXFIRST=$O(^PSX(554,1,2,0)),PSXFIRST=$$FMTE^XLFDT($P($P($G(^PSX(554,1,2,PSXFIRST,0)),"^"),"."))
F PSXIEN=0:0 S PSXIEN=$O(^PSX(554,1,2,PSXIEN)) Q:'PSXIEN S PSXLAST=PSXIEN
S PSXLAST=$$FMTE^XLFDT($P($P($G(^PSX(554,1,2,PSXLAST,0)),"^"),".")) D HD
F PSXIEN=0:0 S PSXIEN=$O(^PSX(554,1,2,PSXIEN)) Q:'PSXIEN D:$Y+3>IOSL HD D:'PSXOUT DISP Q:PSXOUT
EXIT K PSXBDT,PSXBY,PSXEDT,PSXEND,PSXFIRST,PSXIEN,PSXLAST,PSXNODE,PSXOUT,PSXPAGE,PSXSTART
Q
DISP ;Displays one entry in cost task log.
Q:'$D(^PSX(554,1,2,PSXIEN,0)) S PSXNODE=^(0)
W !,$S('+$P(PSXNODE,"^",2):"Queued",+$P(PSXNODE,"^",2)=1:"Running",+$P(PSXNODE,"^",2)=2:"Complete",1:"Unknown")
W ?10,$S($P(PSXNODE,"^",6)="C":"Compile",$P(PSXNODE,"^",6)="P":"Purge",1:"Unknown")
S PSXBDT=$P(PSXNODE,"^",3),PSXEDT=$P(PSXNODE,"^",4)
W ?18,$E(PSXBDT,4,5)_$S(+$E(PSXBDT,6,7):"/"_$E(PSXBDT,6,7),1:"")_"/"_$E(PSXBDT,2,3)_"-"_$E(PSXEDT,4,5)_$S(+$E(PSXEDT,6,7):"/"_$E(PSXEDT,6,7),1:"")_"/"_$E(PSXEDT,2,3),?36,$P(PSXNODE,"^",8)
S PSXSTART=$P(PSXNODE,"^"),PSXEND=$P(PSXNODE,"^",7) W ?43,$E($P(PSXSTART,"."),4,5)_"/"_$E($P(PSXSTART,"."),6,7)_"/"_$E($P(PSXSTART,"."),2,3)_"@"_$E($P(PSXSTART,".",2),1,4)
I $L($E($P(PSXSTART,".",2),1,4))<4 F PSXI=$L($E($P(PSXSTART,".",2),1,4)):1:3 W 0
I +PSXEND W ?57,$E($P(PSXEND,"."),4,5)_"/"_$E($P(PSXEND,"."),6,7)_"/"_$E($P(PSXEND,"."),2,3)_"@"_$E($P(PSXEND,".",2),1,4) D
.I $L($E($P(PSXEND,".",2),1,4))<4 F PSXI=$L($E($P(PSXEND,".",2),1,4)):1:3 W 0
.W ?71,$$FMDIFF^XLFDT(PSXEND,PSXSTART,3)
S PSXBY=$S(+$P(PSXNODE,"^",5):$P($G(^VA(200,+$P(PSXNODE,"^",5),0)),"^"),1:"UNKNOWN")
W !?18,"Queued by: "_PSXBY,!
Q
HD S PSXPAGE=PSXPAGE+1
I PSXPAGE>1 K DIR S DIR(0)="E" D ^DIR K DIR I $G(DTOUT)!($G(DUOUT)) S PSXOUT=1 Q
W @IOF,!?11,"CONSOLIDATED MAIL OUTPATIENT PHARMACY COST ACTIVITY SUMMARY",!?23,"From "_PSXFIRST_" thru "_PSXLAST,!!
W "Status Activity Data Date Range Task# Task Started Task Ended Task Time",!,PSXSLN
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HPSXCSLOG 3694 printed Dec 13, 2024@01:43:51 Page 2
PSXCSLOG ;BIR/JMB-Checks for Active Cost Tasks Before Queuing/View Cost Task Log ;[ 04/08/97 2:06 PM ]
+1 ;;2.0;CMOP;;11 Apr 97
CHECK ;Looks for jobs queued or running for same or overlapping date range.
+1 if '$DATA(^PSX(554,"ARUN"))
QUIT
KILL PSXLOC
SET $PIECE(PSXSLN,"-",80)=""
+2 FOR PSXSTA=-1:0
SET PSXSTA=$ORDER(^PSX(554,"ARUN",PSXSTA))
if PSXSTA=""
QUIT
FOR PSXIEN=0:0
SET PSXIEN=$ORDER(^PSX(554,"ARUN",PSXSTA,PSXIEN))
if 'PSXIEN
QUIT
Begin DoDot:1
+3 if '$DATA(^PSX(554,1,2,PSXIEN,0))
QUIT
+4 IF PSXBDT'<$PIECE(^PSX(554,1,2,PSXIEN,0),"^",3)&(PSXEDT'>$PIECE(^PSX(554,1,2,PSXIEN,0),"^",4))
SET PSXLOC(PSXIEN)=""
QUIT
+5 IF PSXBDT'>$PIECE(^PSX(554,1,2,PSXIEN,0),"^",3)&(PSXEDT'>$PIECE(^PSX(554,1,2,PSXIEN,0),"^",4))&(PSXEDT'<$PIECE(^PSX(554,1,2,PSXIEN,0),"^",3))
SET PSXLOC(PSXIEN)=""
QUIT
+6 IF PSXBDT'<$PIECE(^PSX(554,1,2,PSXIEN,0),"^",3)&(PSXBDT'>$PIECE(^PSX(554,1,2,PSXIEN,0),"^",4))&(PSXEDT'<$PIECE(^PSX(554,1,2,PSXIEN,0),"^",4))
SET PSXLOC(PSXIEN)=""
QUIT
+7 IF PSXBDT'<$PIECE(^PSX(554,1,2,PSXIEN,0),"^",3)&(PSXEDT'>$PIECE(^PSX(554,1,2,PSXIEN,0),"^",4))
SET PSXLOC(PSXIEN)=""
QUIT
+8 if +$GET(PSXCOM)
QUIT
+9 SET PSXBDTE=$EXTRACT($PIECE(^PSX(554,1,2,PSXIEN,0),"^",3),1,5)
SET PSXEDTE=$EXTRACT($PIECE(^PSX(554,1,2,PSXIEN,0),"^",4),1,5)
+10 IF ($EXTRACT(PSXBDT,1,5)'<PSXBDTE&($EXTRACT(PSXBDT,1,5)'>PSXEDTE))!($EXTRACT(PSXEDT,1,5)'<PSXBDTE&($EXTRACT(PSXEDT,1,5)'>PSXEDTE))
SET PSXLOC(PSXIEN)=""
WRITE !,"OH NO!"
End DoDot:1
+11 if '$ORDER(PSXLOC(0))
QUIT
+12 ;Error msg
+13 WRITE !!,"Your task cannot be queued. The following active task(s) is for the same",!,"date range you have selected or for dates that overlap your date range.",!!
SET PSXERR=1
SET $PIECE(PSXSLN,"-",57)=""
+14 WRITE "Status Activity Data Date Range Task# Task Started",!,PSXSLN
+15 FOR PSXIEN=0:0
SET PSXIEN=$ORDER(PSXLOC(PSXIEN))
if 'PSXIEN
QUIT
DO DISP
+16 QUIT
VIEW ;Displays cost entries in 554
+1 IF '$ORDER(^PSX(554,1,2,0))
WRITE !!,"There are no cost entries in the CMOP OPERATIONS file."
GOTO EXIT
+2 SET $PIECE(PSXSLN,"-",80)=""
SET (PSXOUT,PSXPAGE)=0
SET PSXFIRST=$ORDER(^PSX(554,1,2,0))
SET PSXFIRST=$$FMTE^XLFDT($PIECE($PIECE($GET(^PSX(554,1,2,PSXFIRST,0)),"^"),"."))
+3 FOR PSXIEN=0:0
SET PSXIEN=$ORDER(^PSX(554,1,2,PSXIEN))
if 'PSXIEN
QUIT
SET PSXLAST=PSXIEN
+4 SET PSXLAST=$$FMTE^XLFDT($PIECE($PIECE($GET(^PSX(554,1,2,PSXLAST,0)),"^"),"."))
DO HD
+5 FOR PSXIEN=0:0
SET PSXIEN=$ORDER(^PSX(554,1,2,PSXIEN))
if 'PSXIEN
QUIT
if $Y+3>IOSL
DO HD
if 'PSXOUT
DO DISP
if PSXOUT
QUIT
EXIT KILL PSXBDT,PSXBY,PSXEDT,PSXEND,PSXFIRST,PSXIEN,PSXLAST,PSXNODE,PSXOUT,PSXPAGE,PSXSTART
+1 QUIT
DISP ;Displays one entry in cost task log.
+1 if '$DATA(^PSX(554,1,2,PSXIEN,0))
QUIT
SET PSXNODE=^(0)
+2 WRITE !,$SELECT('+$PIECE(PSXNODE,"^",2):"Queued",+$PIECE(PSXNODE,"^",2)=1:"Running",+$PIECE(PSXNODE,"^",2)=2:"Complete",1:"Unknown")
+3 WRITE ?10,$SELECT($PIECE(PSXNODE,"^",6)="C":"Compile",$PIECE(PSXNODE,"^",6)="P":"Purge",1:"Unknown")
+4 SET PSXBDT=$PIECE(PSXNODE,"^",3)
SET PSXEDT=$PIECE(PSXNODE,"^",4)
+5 WRITE ?18,$EXTRACT(PSXBDT,4,5)_$SELECT(+$EXTRACT(PSXBDT,6,7):"/"_$EXTRACT(PSXBDT,6,7),1:"")_"/"_$EXTRACT(PSXBDT,2,3)_"-"_$EXTRACT(PSXEDT,4,5)_$SELECT(+$EXTRACT(PSXEDT,6,7):"/"_$EXTRACT(PSXEDT,6,7),1:"")_"/"_$EXTRACT(PSXEDT,2,3),?36,$PIECE(PSXNO
DE,"^",8)
+6 SET PSXSTART=$PIECE(PSXNODE,"^")
SET PSXEND=$PIECE(PSXNODE,"^",7)
WRITE ?43,$EXTRACT($PIECE(PSXSTART,"."),4,5)_"/"_$EXTRACT($PIECE(PSXSTART,"."),6,7)_"/"_$EXTRACT($PIECE(PSXSTART,"."),2,3)_"@"_$EXTRACT($PIECE(PSXSTART,".",2),1,4)
+7 IF $LENGTH($EXTRACT($PIECE(PSXSTART,".",2),1,4))<4
FOR PSXI=$LENGTH($EXTRACT($PIECE(PSXSTART,".",2),1,4)):1:3
WRITE 0
+8 IF +PSXEND
WRITE ?57,$EXTRACT($PIECE(PSXEND,"."),4,5)_"/"_$EXTRACT($PIECE(PSXEND,"."),6,7)_"/"_$EXTRACT($PIECE(PSXEND,"."),2,3)_"@"_$EXTRACT($PIECE(PSXEND,".",2),1,4)
Begin DoDot:1
+9 IF $LENGTH($EXTRACT($PIECE(PSXEND,".",2),1,4))<4
FOR PSXI=$LENGTH($EXTRACT($PIECE(PSXEND,".",2),1,4)):1:3
WRITE 0
+10 WRITE ?71,$$FMDIFF^XLFDT(PSXEND,PSXSTART,3)
End DoDot:1
+11 SET PSXBY=$SELECT(+$PIECE(PSXNODE,"^",5):$PIECE($GET(^VA(200,+$PIECE(PSXNODE,"^",5),0)),"^"),1:"UNKNOWN")
+12 WRITE !?18,"Queued by: "_PSXBY,!
+13 QUIT
HD SET PSXPAGE=PSXPAGE+1
+1 IF PSXPAGE>1
KILL DIR
SET DIR(0)="E"
DO ^DIR
KILL DIR
IF $GET(DTOUT)!($GET(DUOUT))
SET PSXOUT=1
QUIT
+2 WRITE @IOF,!?11,"CONSOLIDATED MAIL OUTPATIENT PHARMACY COST ACTIVITY SUMMARY",!?23,"From "_PSXFIRST_" thru "_PSXLAST,!!
+3 WRITE "Status Activity Data Date Range Task# Task Started Task Ended Task Time",!,PSXSLN
+4 QUIT