source: FOIAVistA/trunk/r/CMOP-PSX/PSXRPT.m@ 1446

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

initial load of FOIAVistA 6/30/08 version

File size: 7.2 KB
Line 
1PSXRPT ;BIR/WPB,HTW-Routine to Generate Reports at the CMOP Host Facility ;04/08/97 2:06 PM
2 ;;2.0;CMOP;**38**;11 Apr 97
3PRINT S FROM=$P($G(^PSX(552.1,REC,"P")),U,1),BB=$P($G(^PSX(552.1,REC,0)),U,1)
4 S BAT=$P($G(BB),"-",2),RESP="",STA1=$P($G(BB),"-")
5 ;I $G(STA1)]"" S X=STA1,DIC="4",DIC(0)="XMZO" S:$D(^PSX(552,"D",X)) X=$E(X,2,99) D ^DIC S STA2=+Y,STATION=$P(Y,"^",2) K DIC,Y,X ;****DOD L1
6 I $G(STA1)]"" S X=STA1,AGNCY="VASTANUM" S:$D(^PSX(552,"D",X)) X=$E(X,2,99),AGNCY="DMIS" S STA2=$$IEN^XUMF(4,AGNCY,X),STATION=$$NAME^XUAF4(STA2) K AGNCY,Y,X ;****DOD L1
7 S ORDS=$P($G(^PSX(552.1,REC,1)),U,3),RXS=$P($G(^(1)),U,4)
8 S SS=$P($G(^PSX(552.1,REC,0)),U,2)
9 S STAT=$S(SS=2:"Queued",SS=3:"Processed",SS=4:"Closed",SS=5:"Hold",SS=6:"Printed",SS=99:"Rejected",1:"")
10 S Y=RDTTM X ^DD("DD") S RDTTM=Y K Y S RDTTM=$P(RDTTM,":",1,2)
11 W !,RDTTM,?19,FROM,?43,BB,?59,$J(ORDS,5),?68,$J(RXS,5),?75,$E(STAT,1,4) S LN=LN+1
12 ;W !,RDTTM,?20,FROM,?44,BB,?54,$J(ORDS,5),?63,$J(RXS,5),?70,STAT S LN=LN+1
13 I $G(IOST)["C-" D
14 .Q:LN<22
15 .I LN>21 S RESP="",LN=0,DIR(0)="E" D ^DIR S:(Y='1)!($D(DTOUT)) RESP="^" K DIR Q:Y'=1 K Y,X,DIRUT,DIROUT,DTOUT,DUOUT
16 .S LN=0
17 .W @IOF,!
18 .W !,?29,"TRANSMISSIONS "_$S(RPT="Q":"QUEUED",RPT="P":"PROCESSED",RPT="C":"CLOSED",RPT="H":"ON HOLD",RPT="L":"PRINTED",1:"SUMMARY")
19 .W !,?30,RDATE,!! S LN=LN+3
20 .;W "RECEIVED",?20,"FROM",?44,"BATCH",?55,"TOTAL",?64,"TOTAL",?72,"STATUS",!
21 .;W "DATE/TIME",?44,"NUMBER",?55,"ORDERS",?65,"RXS",!
22 .W "RECEIVED",?19,"FROM",?43,"BATCH",?59,"TOTAL",?68,"TOTAL",?75,"STAT",!
23 .W "DATE/TIME",?43,"NUMBER",?59,"ORDERS",?68,"RXS",!
24 .S LL="-" F JJ=0:1:79 W LL
25 .W ! S LN=LN+3
26 I $G(IOST)'["C-"&(LN>60) D
27 .S LN=0
28 .W @IOF,!
29 .W !,?29,"TRANSMISSIONS "_$S(RPT="Q":"QUEUED",RPT="P":"PROCESSED",RPT="C":"CLOSED",RPT="H":"ON HOLD",RPT="L":"PRINTED",1:"SUMMARY")
30 .W !,?30,RDATE,!! S LN=LN+3
31 .;W "RECEIVED",?20,"FROM",?44,"BATCH",?55,"TOTAL",?64,"TOTAL",?72,"STATUS",!
32 .;W "DATE/TIME",?44,"NUMBER",?55,"ORDERS",?65,"RXS",!
33 .W "RECEIVED",?19,"FROM",?43,"BATCH",?59,"TOTAL",?68,"TOTAL",?75,"STAT",!
34 .W "DATE/TIME",?43,"NUMBER",?59,"ORDERS",?68,"RXS",!
35 .S LL="-" F JJ=0:1:79 W LL
36 .W ! S LN=LN+4
37 Q:$G(RESP)="^"
38 S NEXT=REC+1
39 Q:'$D(^PSX(552.1,NEXT,0))
40 Q
41EXIT I '$G(POP) S DIR(0)="E",DIR("A")="Press RETURN to continue" D ^DIR K DIR
42EXIT1 W @IOF K RPT,XX,DATE,RDATE,Y,%,X,FROM,ORDS,RXS,BB,STAT,RESP,RDT,RDTTM,LL,BAT,REC,SS,SITE,JJ,LN,NEXT,STA1,STA2,STATION,COM,COM2,EE,END,ORD,REVD,SP,SP1,SP2,TBB,X1,XT,XY
43 K ZTRTN,ZTIO,PSXLION,ZTDESC,ZTSAVE,ZTSK,%ZIS,DIR,DTOUT,DIROUT,DUOUT,DIRUT,^TMP($J,"PSXRPT")
44 I $G(IOST)'["C-" W @IOF
45 D ^%ZISC
46 S:$D(ZTQUEUED) ZTREQ="@"
47 Q
48QUE S ZTRTN="RPT^PSXRPT",ZTIO=PSXLION,ZTSAVE("RDT")="",ZTSAVE("RPT")="",ZTSAVE("END")="",ZTSAVE("TBB")="",ZTSAVE("ORD")="",ZTDESC="CMOP Transmission Report Summary" D ^%ZTLOAD
49 I $D(ZTSK)[0 W !!,"Job Canceled"
50 E W !!,"Job Queued"
51 D HOME^%ZIS
52 Q
53EN S DIR(0)="SOM^S:Summary;Q:Queued;P:Processed;C:Closed;H:Hold;L:Labels Printed"
54 S DIR("A")="Select",DIR("B")="Q",DIR("??")="^D HELP^PSXRPT"
55 D ^DIR K DIR S RPT=Y G:Y=0 EXIT1 G:$D(DIRUT) EXIT1
56 K DIR,DIRUT,DIROUT,DTOUT,DUOUT,X,Y
57 ;G:"HL"[RPT R1
58 S DIR(0)="S^A:Ascending Order;D:Descending Order",DIR("B")="Ascending",DIR("??")="^D HELP1^PSXRPT"
59 D ^DIR K DIR S ORD=Y Q:Y=""!($D(DIRUT))!($D(DUOUT))!($D(DIROUT))!($D(DTOUT))
60 K DIR,DIRUT,DIROUT,DTOUT,DUOUT,X,Y
61 I "SQPCHL"'[RPT Q
62R1 I "SCPLHQ"[RPT D G:$G(Y)<0 EXIT
63 .S:"HL"[RPT ORD="A"
64 .W !! S %DT="AEX",%DT("A")="Enter Begin Date for Report: ",%DT(0)="-NOW",%DT("B")="TODAY" D ^%DT Q:Y<0!($D(DTOUT)) S TBB=Y,RDT=$$FMADD^XLFDT(TBB,-1,0,0,0)_".9999"
65 .W ! S %DT("A")="Enter End Date for Report: " D ^%DT K %DT Q:Y<0!($D(DTOUT)) S EE=Y,END=EE_".9999"
66 .K %DT("A"),%DT("B"),%DT(0),Y,X,DTOUT
67 .I TBB>EE W !,"Beginning date must be before ending date." G R1
68DEV S %ZIS="Q" D ^%ZIS S PSXLION=ION G:$G(IOST)["C-"&('POP) RPT I POP W !,"NO DEVICE SELECTED" G EXIT
69 I $D(IO("Q")) D QUE,EXIT1 Q
70 I '$D(IO("Q")) G RPT
71 Q
72 ;Taskman entry point to start the transmission summary report
73RPT D NOW^%DTC S Y=% X ^DD("DD") S DATE=Y,RDATE=$P(DATE,"@",1)_" "_$E($P(DATE,"@",2),1,5),LN=0
74 I '$D(ZTSK) U IO
75 W @IOF
76HDR S COM="TRANSMISSIONS "_$S(RPT="Q":"QUEUED",RPT="P":"PROCESSED",RPT="C":"CLOSED",RPT="H":"ON HOLD",RPT="L":"PRINTED",1:"SUMMARY"),COM2=$P($$FMTE^XLFDT(TBB,"2S"),"@",1)_" THRU "_$P($$FMTE^XLFDT(END,"2S"),"@",1)
77 S SP2=(80-$L(COM2))/2,SP=(80-$L(COM))/2,SP1=(80-$L(RDATE))/2
78 W !,?SP,COM,!,?SP2,COM2,!! S LN=LN+4
79 ;W !,?SP1,RDATE,!! S LN=LN+5
80 W "RECEIVED",?19,"FROM",?43,"BATCH",?59,"TOTAL",?68,"TOTAL",?75,"STAT",!
81 W "DATE/TIME",?43,"NUMBER",?59,"ORDERS",?68,"RXS",!
82 ;W "RECEIVED",?20,"FROM",?44,"BATCH",?55,"TOTAL",?64,"TOTAL",?72,"STATUS",!
83 ;W "DATE/TIME",?44,"NUMBER",?55,"ORDERS",?65,"RXS",!
84 S LL="-" F JJ=0:1:79 W LL
85 W ! S LN=LN+2
86 I $G(ORD)="D" G DESC
87 I (RPT="S")!(RPT="C")!(RPT="Q")!(RPT="P") G DATA
88 I RPT="H"!(RPT="L") G QDATA
89 W !!
90 S DIR(0)="Y",DIR("B")="NO",DIR("A")="Another report" D ^DIR K DIR G:Y=1 EN
91 G EXIT1
92 Q
93DATA S XX=$S(RPT="Q":"AQ",RPT="S":"AR",RPT="C":"AC",RPT="P":"AP",1:"")
94 S XT=0,XY=RDT F S XY=$O(^PSX(552.1,XX,XY)) Q:XY=""!(XY>END) S XT=XT+1
95 I '$D(^PSX(552.1,XX))!($G(XT)'>0) W !!,"No data for the report." G EXIT
96 ;S RDT="" F S RDT=$O(^PSX(552.1,XX,RDT)) Q:(RDT="") S SITE="" F S SITE=$O(^PSX(552.1,XX,RDT,SITE)) Q:'SITE F REC=0:0 S REC=$O(^PSX(552.1,XX,RDT,SITE,REC)) Q:REC'>0 S RDTTM=RDT K Y D PRINT G:RESP="^" EXIT1
97 F S RDT=$O(^PSX(552.1,XX,RDT)) Q:(RDT="")!(RDT>END) S SITE="" F S SITE=$O(^PSX(552.1,XX,RDT,SITE)) Q:'SITE F REC=0:0 S REC=$O(^PSX(552.1,XX,RDT,SITE,REC)) Q:REC'>0 S RDTTM=RDT K Y D PRINT G:RESP="^" EXIT1
98 G:$G(IOST)'["C-" EXIT1
99 G EXIT
100QDATA S XX=$S(RPT="H":"AH",RPT="L":"AE",1:"")
101 I '$D(^PSX(552.1,XX)) W !!,"No data for the report." G EXIT
102 S SITE="" F S SITE=$O(^PSX(552.1,XX,SITE)) Q:'SITE F REC=0:0 S REC=$O(^PSX(552.1,XX,SITE,REC)) Q:REC'>0 S RDTTM=$P($G(^PSX(552.1,REC,0)),U,4) Q:RDTTM<TBB!(RDTTM>END) D PRINT G:RESP="^" EXIT1
103 G:$G(IOST)'["C-" EXIT1
104 G EXIT
105DESC S XX=$S(RPT="Q":"AQ",RPT="S":"AR",RPT="C":"AC",RPT="P":"AP",1:"")
106 S XT=0,XY=RDT F S XY=$O(^PSX(552.1,XX,XY)) Q:XY=""!(XY>END) S XT=XT+1
107 I '$D(^PSX(552.1,XX))!($G(XT)'>0) W !!,"No data for the report." G EXIT
108 F S RDT=$O(^PSX(552.1,XX,RDT)) Q:(RDT="")!(RDT>END) S SITE="" F S SITE=$O(^PSX(552.1,XX,RDT,SITE)) Q:'SITE F REC=0:0 S REC=$O(^PSX(552.1,XX,RDT,SITE,REC)) Q:REC'>0 S REVD=9999999.9999-RDT,^TMP($J,"PSXRPT",REVD,REC)=""
109 D DESC1
110 Q
111DESC1 S X1="" F S X1=$O(^TMP($J,"PSXRPT",X1)) Q:X1="" S REC=0 F S REC=$O(^TMP($J,"PSXRPT",X1,REC)) Q:REC'>0 S RDTTM=$P(^PSX(552.1,REC,0),"^",4) K Y D PRINT G:RESP="^" EXIT1
112 K X1,Y1
113 G:$G(IOST)'["C-" EXIT1
114 G EXIT
115HELP W !!,"S - Provides a report of all transmissions received for the date range entered."
116 W !,"Q - Provides a report of all transmissions that are queued to download to the",!,"vendor for the date range entered."
117 W !,"P - Provides a report of all transmissions that are processed for the date range",!,"entered."
118 W !,"C - Provides a report of all transmissions that are closed for the date range",!,"entered."
119 W !,"H - Provides a report of all transmissions that are on hold status for the date range entered."
120 W !,"L - Provides a report of all transmissions that were printed for the date range entered."
121 Q
122HELP1 W !!,"Ascending order will order data starting with the earliest date.",!,"Descending order will order the data starting the latest date."
123 Q
Note: See TracBrowser for help on using the repository browser.