source: WorldVistAEHR/trunk/r/EQUIPMENT_TURN_IN_REQUEST-PRCN/PRCNSERP.m@ 1710

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

initial load of WorldVistAEHR

File size: 3.3 KB
RevLine 
[613]1PRCNSERP ;SSI/ALA-Service Priority Report ;[ 02/04/97 6:44 PM ]
2 ;;1.0;PRCN;**3,7**;Sep 13, 1996
3EN ; Begin report by selecting a service
4 S DIR(0)="SM^O:Select One Service;A:Select All Services",DIR("A")="Select Print Type "
5 D ^DIR K DIR S VTI=$TR(X,"ao","AO") I VTI["^" G EXIT
6 I VTI="O" D SRV G EXIT:$G(SRV)=""
7 S $P(LIN,"-",80)="",PG=0
8 S %ZIS="MQ" D ^%ZIS G EXIT:POP>0
9 I $D(IO("Q")) D G EXIT
10 . S ZTRTN="BEG^PRCNSERP",ZTDESC="Service Priority Report"
11 . S ZTSAVE("VTI")="",ZTSAVE("LIN")="",ZTSAVE("PG")="",ZTSAVE("SRVNM")=""
12 . I $G(SRV)'="" S ZTSAVE("SRV")=""
13 . D ^%ZTLOAD,HOME^%ZIS K IO("Q"),ZTSK,%ZTLOAD,ZTREQ
14 I $E(IOST)="P" U IO
15BEG I VTI="O" S PRI="",TOTAL=0 D HDR G PRI
16 S SRV=""
17ALL S SRV=$O(^PRCN(413,"P",SRV)) I SRV="" D CONT G EXIT
18 S PRI="",TOTAL=0,SRVNM=$P(^DIC(49,SRV,0),U) D Q:$G(PRCNC)'=""
19 . I $E(IOST)'="P",PG>0 D Q:$G(PRCNC)'=""
20 . . R !,"Press RETURN to continue or '^' to quit. ",PRCNC:DTIME S:'$T PRCNC=U
21 . . K:PRCNC'?1"^".E PRCNC
22 . D HDR
23PRI S PRI=$O(^PRCN(413,"P",SRV,PRI))
24 I PRI="" G ALL:VTI'="O" I VTI="O" D CONT G EXIT
25 S TRN=""
26TRN S TRN=$O(^PRCN(413,"P",SRV,PRI,TRN)) G PRI:TRN=""
27 S PRCNDAT0=$G(^PRCN(413,TRN,0)) I PRCNDAT0="" K ^PRCN(413,"P",SRV,PRI,TRN) G TRN
28 S PRCNL=$P(PRCNDAT0,U,9),PRCNLDD=$P(^DD(413,8,0),U,3)
29 S PRCNF="" F LL=1:1 Q:$P(PRCNLDD,";",LL)="" I $P(PRCNLDD,";",LL)[PRCNL_":" S PRCNF=$P($P(PRCNLDD,";",LL),":",2) Q
30 I $G(PRCNC)'="" D EXIT Q
31 W !,$P(PRCNDAT0,U),?20,PRI,?40,$E(PRCNF,1,8)
32 S NL=NL+1 D CHKPG G EXIT:$G(PRCNC)'=""
33 S RQ=0 F S RQ=$O(^PRCN(413,TRN,1,RQ)) Q:RQ'>0 D
34 . S PRCNIT0=^PRCN(413,TRN,1,RQ,0),COST=$P(PRCNIT0,U,4),QTY=$P(PRCNIT0,U,5)
35 . S SBTOT=COST*QTY,TOTAL=TOTAL+SBTOT
36 . S PRCNL=$P(PRCNDAT0,U,9),PRCNLDD=$P(^DD(413.015,8,0),U,3)
37 . S PRCNF="" F LL=1:1 Q:$P(PRCNLDD,";",LL)="" I $P(PRCNLDD,";",LL)[PRCNL_":" S PRCNF=$P($P(PRCNLDD,";",LL),":",2) Q
38 . D ITD
39 G TRN
40SRV S DIC(0)="AEQZ",DIC="^DIC(49," D ^DIC Q:+Y<0
41 S SRV=+Y,SRVNM=$P(Y,U,2) K DIC,Y
42 Q
43CONT Q:$G(PRCNC)
44 I $G(TOTAL)'="" W !,?72,$E(LIN,1,7),!,?70,$J(TOTAL,9,2) D CHKPG
45 I $G(TOTAL)=""!($G(TOTAL)=0) W !,?35,"*** NO RECORDS TO PRINT *** "
46 I $E(IOST)="P" W @IOF
47EXIT K SRV,SRVNM,PRI,VTI,PRCNF,PRCNIT0,PRCNL,PRCNLDD,QTY,RQ,RDQ,SBTOT,TOTAL
48 K LIN,LL,NL,PG,PI,PRCNDAT0,RQD,COST,QTY,TRN,TXT,X,DN,C,PRCNC,I,Y,Z
49 K DIW,DIWF,DIWI,DIWL,DIWR,DIWT,DIWTC,DIWX
50 D ^%ZISC
51 Q
52CHKPG ; If printing to screen & it is full, clear screen, if printing to
53 ; a printer take appropriate action
54 Q:$G(PRCNC)'=""
55 Q:IOSL>(NL+6)
56 I $E(IOST)="C" W !,"Press RETURN to continue or '^' to quit. " R PRCNC:DTIME S:'$T PRCNC=U K:PRCNC'?1"^".E PRCNC Q:$G(PRCNC)'=""
57 D HDR
58 Q
59HDR ; Print a header for the report
60 U IO S PG=PG+1,$P(TXT," ",40)="" W @IOF
61 W !,"REQUESTS BY SERVICE PRIORITY"
62 W $J("",IOM-$L(TXT)\2) S X="N",%DT="T" D ^%DT
63 W $$FMTE^XLFDT(Y,"1P")_" PAGE: "_PG,!
64 W !,"TRANSACTION #",?20,"PRIORITY",?40,"TYPE",?54,"COST",?62,"QUANTITY",?73,"TOTAL"
65 W !,?39,"PARENT SYSTEM",!,?5,"ITEM DESCRIPTION",?39,"/ COMPONENT"
66 W !,?40,"JUSTIFICATION",!,LIN,!
67 W !,"SERVICE: ",SRVNM,!
68 S NL=10
69 Q
70ITD ; Get item description and format
71 K ^UTILITY($J,"W") S DIWR=27,DIWL=1,DIWF=""
72 S RQD=0 F S RQD=$O(^PRCN(413,TRN,1,RQ,1,RQD)) Q:RQD'>0 S X=^PRCN(413,TRN,1,RQ,1,RQD,0) D ^DIWP
73 I $G(^UTILITY($J,"W",DIWL))="" Q
74 F PI=1:1:^UTILITY($J,"W",DIWL) S NL=NL+1 D CHKPG Q:$G(PRCNC)'="" W !,?5,^UTILITY($J,"W",DIWL,PI,0) I PI=1 D
75 . W ?38,$E(PRCNF,1,12),?54,$J(COST,6,2),?62,$J(QTY,4,0),?73,$J(SBTOT,6,2)
76 Q
Note: See TracBrowser for help on using the repository browser.